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
Python installed from: python.org
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
<https://github.com/pyinstaller/pyinstaller/blob/3ea48fd875e786ecbb3c160209791aa11d55ae99/PyInstaller/lib/modulegraph/modulegraph.py#L2764>
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.
1. Link <https://github.com/pyinstaller/pyinstaller/pull/5830>
2. Link
<https://github.com/pyinstaller/pyinstaller/issues/6301#issuecomment-962519524>
3. And this link
<https://github.com/pyinstaller/pyinstaller/commit/ed732c92eded85e6bca4232eedefee2906bbfa52>
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
<https://github.com/pyinstaller/pyinstaller/blob/1e6a8d53f150cf24b574c32085f3745cbd2afaa6/PyInstaller/depend/bytecode.py#L13>*,
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?
Reference
<https://docs.python.org/3/library/dis.html?highlight=load_const#opcode-LOAD_CONST>
to extended_arg from *dis.py*.
Thank you,
Eduardo
--
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/6a5e44bd-ba26-433e-9048-22cea77326c9n%40googlegroups.com.