I'm trying to build a Windows exe using pyinstaller (my second time) and 
I'm using the formulas package from PYPI.
See: 
https://formulas.readthedocs.io/en/stable/_build/formulas/formulas.excel.html
and https://pypi.org/project/formulas/

I'm using a class ExcelModel from formulas. I can import this successfully 
into VSCode and run it no problem using a variety of import statements, 
including the simplest: import formulas
However, pyinstaller cannot locate this ExcelModel class.
After a lot of fiddling using pyinstaller diagnostics (Thanks!) I've come 
to the conclusion that the problems are:

1) The ExcelModel class is located in the formulas\excel\__init__.py file, 
rather than in, for instance, formulas\excel\ExcelModel.py.

2) With pyinstaller I've tried many --hidden-import expressions and a few 
alternative Python import statements and I cannot get pyinstaller to 
recognise that ExcelModel class exists anywhere, unless I use: "from 
formulas.excel.__init__ import ExcelModel"
This statement works in VSCode and also causes pyinstaller to find the 
__init__ module containing ExcelModel class. Yay!
However, the __init__ module uses relative paths in its import statements 
and these immediately fail because of the strange import statement that 
I've been forced to use to get pyinstaller to find the module containing 
ExcelModel.

So, what's my problem: Is this one bug or two?

I presume that the formulas structure is undesirable or incorrect and I 
will ask the author about that.

However, why can't pyinstaller find the ExcelModel class inside the 
__init__.py file when using a simple "import formulas" statement when 
VSCode's python environment can find it?
Is this a blind spot in pyinstaller?

Is there some incantation that I haven't tried which will address this 
problem? 
Surely this problem isn't unusual? Why would a naming structure issue make 
generation of an executable impossible when the code runs in an IDE?

Thanks in advance for your comments.

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/ab21a879-8ef0-4881-af8f-40ceda8bd4c6o%40googlegroups.com.

Reply via email to