pyinstaller, wxpython, core not found

Sometimes an error and the error message are different things. One of the examples is that my wxpython-program did not want to start after converting to exe using pyinstaller:

ImportError: No module named _core_

The two confusing things for me were:

* Some time ago the exe-version worked
* There is a file wx._core_.pyd in the program's directory

And a minimal test example worked again!

After some meditation, the root of the problem was found:

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

More precisely, "reload" does not work with PyInstaller. At the moment I don't know a good solution and just have commented out the problem line.

Vibe code with your voice

Stop fighting speech recognition.
Just talk → fix mistakes later

"... _brings_ hello world"   ❌
          ↓
"... _prints_ hello world"   ✅

Get handsfree.vc on Google Play

Categories: python

Updated: