DEV Community

Discussion on: How to convert .py to .exe? Step by step guide.

Collapse
 
armanniko profile image
ArmanNiko

Hey there!

I'm programming with pygame. I have done whatever was in the post but it still gives me fatal error when i run the .exe file. I'm using one file and windowed, and I've written the resource_path function in my code. and I've used it like this:
image1 = pygame.image.load(resource_path('filename.png'))
I wanted to ask is this correct? and if it is then why am i having trouble running the .exe file. and if it's not, then what else should i do?

Collapse
 
eshleron profile image
Eshleron

Hi!
I've never used pygame, so regarding that I'm not competent to give any advice.

But what I think might be happening:

  1. Image format(.png) What I found on pygame.org
    "pygame may not always be built to support all image formats. At minimum it will support uncompressed BMP. If pygame.image.get_extended() returns 'True', you should be able to load most images (including PNG, JPG and GIF)."
    I'd check that first.

  2. The way the image is loaded. Kind of through another function. I'd separate the code, meaning creating image first(path to image or you can try creating image object), than loading it, checking if everything is OK.

Anyway, without any extended code or error messages I can do more than guess.

Some comments have been hidden by the post's author - find out more