I’m building a GUI program in Python 3.8 and I want to convert the Python program to an executable, it always worked. But since I’m using the Python megawidget I can’t open the exe file anymore.
I guess the problem is somewhere with installing the pmw. I did ‘pip install pmw’ and it says ‘Requirement already satisfied’ but if I look into the modules there is no pmw.
After converting the Python script to exe using pyinstaller
, trying to open the exe gives this error:
FileNotFoundError: [WinError 3] The system cannot find the path specified: <path_to_script_dir>\Pmw
What am I doing wrong?
Advertisement
Answer
First of all the error is due to Pmw using a lazy import, to fix it try going to this link and then copy the entire code and create a new file in your project directory(where the python script is located) and then name it Pmw.py
and then paste this entire code in that file. After that, just just try making an exe. It should work for Pmw.ScrolledText()
. I had the issue with Pmw.Balloon()
and this fixed it.
Naming the file to Pmw.py
overrides the import Pmw
statement in your code and now this Pmw file is used, which should fix your error with pyinstaller.
NOTE: If you are not using other modules like PmwColor
or PmwBlt
then make sure to remove the first 10 lines there(which imports those files).