0

I get this error when running PyInstaller, py2exe, and Auto Py to Exe. I have uninstalled and reinstalled both Python and PyInstaller. My Python version is 3.9.2, 64 bit.

I finished my app, but it doesn't want to become an .exe. I get a slightly different error when using py2exe, as it says error instead of OSError.

Here's what I ran and the result from using py2exe:

PS C:\Users\nstil\Desktop\Coding\MC> python setup.py py2exe
running py2exe
error: [WinError 193] %1 is not a valid Win32 application

Here's setup.py:

from distutils.core import setup
import py2exe

setup(console=['MC.py'])
Noah
  • 11
  • 3
  • The three tools you have tried are completely different. Do you get the error when you run the tools or when you run the executable they produce? And do all three really give *exactly* the same error message? That is at the least unlikely. Choose one tool, show us how you invoked it and what it said in the process of wrapping up the executable. – BoarGules Mar 28 '21 at 23:44
  • @BoarGules I've updated the question. I get the error when I run the tools. Pyinstaller and Auto Py to Exe give the same error message, and py2exe says `error` instead of `OSError`, but they both have the same error text. – Noah Mar 29 '21 at 13:32
  • I haven't used `py2exe` for years because it went dormant after Python 3.3 and was only recently revived. But `pyinstaller` has comprehensive docs on what to do when things go wrong, that I have found very helpful. I suggest you work through that. – BoarGules Mar 29 '21 at 13:50
  • Does https://stackoverflow.com/questions/56724023/oserror-winerror-193-1-is-not-a-valid-win32-application-when-trying-to-imp help? – Karl Knechtel Mar 29 '21 at 15:33
  • @KarlKnechtel no, I saw that but it isn't the same situation. I solved the issue but thanks anyway. – Noah Mar 31 '21 at 15:04
  • Right, 64/32-bit mismatch is a common cause for this problem too. I think there are some comments on the other question mentioning that. I've seen a few questions like this but none are ever really *exact* duplicates.... – Karl Knechtel Mar 31 '21 at 19:37

1 Answers1

0

I ended up uninstalling my Python 3.9.2 (64-bit) and installed the 32-bit version, and it fixed the issue. Although, another issue occurs now.

Noah
  • 11
  • 3