'Pygame Module' not working
MRAB
python at mrabarnett.plus.com
Sat Jul 31 16:36:12 EDT 2021
On 2021-07-31 20:46, Dennis Lee Bieber wrote:
> On Sat, 31 Jul 2021 14:07:05 +0530, 37_VA_VEER CHAKRABORTY
> <veerchakraborty612 at gmail.com> declaimed the following:
>
>>pygame.image.load('assets/Flappy Bird.png')
>>However, when I ran the script it was showing an error message - File not
>>found
>>Please advise me on how to upload the sprites and where I was going wrong.
>
> First attempt: use a full pathname.
>
> Second: determine what the "current working directory" is in which your
> program is running, then use a pathname relative to that directory.
>
The path of the program itself should be in __file__. You can then use
os.path.dirname to get the path of its folder and os.path.join to build
a path from that to the image file.
More information about the Python-list
mailing list