Suppose I have a minimal PyInstaller spec file, e.g. the hello_world.spec
that is created when I run pyinstaller hello_world.py
(also see docs). This spec file has python code but no import statements.
Now suppose I customize this file, e.g. using the Tree
and TOC
classes, but something is going wrong and I need to find out what.
I am aware of the PyInstaller --log-level
options and warn*.txt files, but I would prefer to place some break-points in my IDE and debug the spec file (or maybe just play around with the Tree
class in the console). However, debugging does not work out-of-the-box because there are no import statements in the spec file. I can add those, as below, for example:
from PyInstaller.building.build_main import Analysis, PYZ, EXE, COLLECT
from PyInstaller.building.datastruct import TOC, Tree
But then it turns out some configuration info is required, as I keep running into KeyError
s related to CONF
. I tried adding those key/value-pairs manually, based on a list of globals from the docs, which appears to work, up to a point, but I cannot help thinking I'm doing something wrong...
import PyInstaller.config
PyInstaller.config.CONF['specnm'] = 'hello_world'
... etc. ...
Could someone tell me what is the right way to do this? Should I just stick with the pyinstaller --log-level
approach?