Attributeerror: After Converting Python Script To Exe By Pyinstaller
I have made a python script for calculations purposes, importing libraries, Tkinter, Pmw, sympy, math, tkfiledialog, webbrowser. Now, by using Pyinstaller I convert it into an EXE
Solution 1:
I ran into the same problem. It is due to what I would call 'dynamic imports', made mostly in PmwLoader.py (placed in lib subfolder): PmwLoader loads all the files, and the they become attributes of Pmw global library.
The solution I found was to manually delete the line 'import Pmw' in all the wanted Pmw files (I only used PmwComboBox and PmwScrolledFrame). PmwCombobox and PmwScrolledFrame notably need to import other Pmw files, so I had to replace import Pmw by
import PmwBase
import PmwScrolledListBox
import PmwEntryField
import PmwTimeFuncs
and then do the same in PmwScrolledListBox and PmwEntryFiled.
The the fun is to solve the bugs --notably replace a lot of the MegaWidget by PmwBase.MegaWidget, and so on.
In the end, it does not take more than one hour.
Good luck! t.
Post a Comment for "Attributeerror: After Converting Python Script To Exe By Pyinstaller"