Wasn't sure whether or not to make this an issue so posting this here first.
PyInstaller version: 4.10
Version of Python: 3.6.8
Platform: Windows 10
Didn't try on another platform.
Will try development version if necessary.
Clean installation.
Ran program from command window
Used --onedir mode
Error:
\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2771, in _scan_bytecode
assert prev_insts[-2].opname == 'LOAD_CONST'
AssertionError
Command line used: pyinstaller -F --clean --paths {paths --collect-all {name1} --collect-all {name2} script.py
The problem arises when using .pyc files for the modules in name1 and name2.
The problem does not occur when I comment out this line in modulegraph.py. - When I run pyinstaller without line 2764 (linked above), everything runs to completion and the executable generated works as intended.
I've been trying to look through previous commits to try and understand the reason for the
assert statement and why it is necessary. Could it perhaps no longer be necessary?
The prev_insts[-2].opname variable is equal to EXTENDED_ARG thus causing the assert statement to fail.
There's been a few issues before related to extend_arg but not my exact problem as well as commits.
- Link
- Link
- And this link seems to be the commit for the first variation of the LOAD_CONST assert but it's not clear to me why it's there.
Based on what I found in PyInstaller's current
bytecode.py, it does seem like this line may need to be expanded on:
The biggest clarity killer here is the ``EXTENDED_ARG`` opcode which can appear almost anywhere and therefore needs to be tiptoed around at every step. If this code needs to expand significantly, I would recommend an upgrade to a regex-based grammar parsing library such as Reparse. This way, little steps like unpacking ``EXTENDED_ARGS`` can be defined once then simply referenced forming a nice hierarchy rather than copied everywhere its needed.
Could you please provide some information about why this type of opcode requires an exception to be thrown and why PyInstaller works when the assertion is removed? Or just confirm with me whether or not it is safe for me to continue on with the line removed? Or even just a way to avoid running into this exception?
Thank you,
Eduardo