[Tutor] Issues with converting python file to .exe

Mikael Lenander mikael.lenander1 at gmail.com
Mon Nov 25 07:20:10 EST 2019


I tried to make an .exe file with python so that I could run my program
without python and I could send it to my friends. I installed pyinstaller
and gave this command through the command prompt successfully: "pyinstaller
--onefile pää.py". The application is saved in the same folder as all the
dependencies (for example images). However, when I try to open my program,
this error occurs:

"pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "pää.py", line 91, in <module>
    fontti = pygame.font.Font('freesansbold.ttf', 22)
  File "site-packages\pygame\pkgdata.py", line 50, in getResource
  File "site-packages\pkg_resources\__init__.py", line 1134, in
resource_exists
  File "site-packages\pkg_resources\__init__.py", line 1404, in has_resource
  File "site-packages\pkg_resources\__init__.py", line 1472, in _has
NotImplementedError: Can't perform this operation for unregistered loader
type
[2636] Failed to execute script põõ".

I tried the same thing with a more simple python file and everything worked
flawlessly. So, I suppose there is an issue with my program "pää.py", but I
don't know what the problem is. I don't know if it has anything to do with
this but when I run the program "pää.py" through Pycharm, it throws at me
this warning "DeprecationWarning: an integer is required (got type float).
Implicit conversion to integers using __int__ is deprecated, and may be
removed in a future version of Python.
  screen.blit(vastus[i], (x, y))".

Versions: pygame 1.9.6, python 3.8, pyinstaller 4.0.dev0+1eadfa55f2,
windows

Kind regards
Mikael


More information about the Tutor mailing list