DEV Community

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

 
qfactorin profile image
qFactorin

Hi Eshleron, thank you for taking time and looking in to it. I managed to resolve the issue.
I was unsure of the conflict so have installed python from scratch on a new virtual machine and tried creating exe without installing any packages.

  1. Installed packages that were only part of error logs.
  2. finally found out that reason for the failure was related to hidden import "babel.numbers".
  3. included that as parameter in hidden imports in auto-py-to-exe, and boom everything worked........
Thread Thread
 
eshleron profile image
Eshleron

Glad you got it fixed!

Thread Thread
 
eshleron profile image
Eshleron • Edited

So now I have encountered "SystemExit: pre-safe-import-module hook failed, needs fixing." error myself. I've tried "babel.numbers" solution, didn't help. What helped me solve it was a combination of google search and intuition.

My error was something like this: "PyInstaller\hooks\pre_safe_import_module\hook-urllib3.packages.six.moves.py", line 33, in pre_safe_import_module"

  1. First, as the internet suggested, I uninstalled "usual" Pyinstaller and installed Pyinstaller dev with:
    pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip.
    That took care of this problem.

  2. But then the second problem emerged: "ImportError: Module 'pywintypes' isn't in frozen sys.path". That was solved by excluding pywin32 from imports in Auto-py-to-exe (Pyinstaller).

I hope this helps someone sometime!
Good luck coding!

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