Reputation: 31
There is some code I want to turn into an exe. I have used Pyinstaller and I manage getting an exe that runs. The platform is Win10, Python version 3.6, devs with Spyder. At some point in the code, the following lines pose an issue with the exe (not in script mode):
from formulas import parser as formulasparser
# code including classes
# in a function:
t = 'x<1' # any string that is a 'formula', here provided for the example
parser_ = formulasparser.Parser()
# the exe works so far, I have traced the code and can read the messages in the windows cmd
func = parser_.ast(t)
# nothing happens and no way to get a trace; there is an issue, and I have no clue which one as there
# is no error message.
So, it seems that the ast function won't work for some reason. Can anyone help me? I need to distribute this application and it does not work because of this right now.
Thanks for your help.
Upvotes: 1
Views: 55
Reputation: 31
Well, someone seems to have faced a somewhat similar issue on the Pyinstaller mailing list. So: a hook file is actually needed. I created a directory called pyinstallerhooks with a file called hook-formulas.py inside. The file itself contains:
from PyInstaller.utils.hooks import collect_all
datas, binaries, hiddenimports = collect_all('formulas')
and this is it. When calling pyinstaller, use the following command: pyinstaller --additional-hooks-dir pathtoyourdir -F yoursrcipt.py
Pyinstaller fetches the relevant dependencies for the formulas package and it shoudl work.
Upvotes: 1