PyInstaller dis.py tuple index out of range
2023-01-08
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook target_modules = self.import_hook(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook target_package, target_module_partname = self._find_head_package(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package target_package = self._safe_import_module(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2061, in _safe_import_module n = self._scan_code(module, co, co_ast)
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2645, in _scan_code self._scan_bytecode(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2749, in _scan_bytecode for inst in util.iterate_instructions(module_code_object):
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 141, in iterate_instructions yield from (i for i in get_instructions(code_object) if i.opname != "EXTENDED_ARG")
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 141, in
yield from (i for i in get_instructions(code_object) if i.opname != "EXTENDED_ARG")
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\dis.py", line 338, in _get_instructions_bytes argval, argrepr = _get_const_info(arg, constants)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\dis.py", line 292, in _get_const_info argval = const_list[const_index]
IndexError: tuple index out of range
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook target_modules = self.import_hook(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook target_package, target_module_partname = self._find_head_package(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package target_package = self._safe_import_module(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2061, in _safe_import_module n = self._scan_code(module, co, co_ast)
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2645, in _scan_code self._scan_bytecode(
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2749, in _scan_bytecode for inst in util.iterate_instructions(module_code_object):
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 141, in iterate_instructions yield from (i for i in get_instructions(code_object) if i.opname != "EXTENDED_ARG")
File "C:\Users\admin\.virtualenvs\1t-96iTJiyd\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 141, in
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\dis.py", line 338, in _get_instructions_bytes argval, argrepr = _get_const_info(arg, constants)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\dis.py", line 292, in _get_const_info argval = const_list[const_index]
IndexError: tuple index out of range
解决办法
#C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\dis.py #在文件422位置 def _unpack_opargs(code): extended_arg = 0 for i in range(0, len(code), 2): op = code[i] if op >= HAVE_ARGUMENT: arg = code[i+1] | extended_arg extended_arg = (arg << 8) if op == EXTENDED_ARG else 0 else: arg = None yield (i, op, arg)
改成这样的
#就是在else里面加上 extended_arg = 0 def _unpack_opargs(code): extended_arg = 0 for i in range(0, len(code), 2): op = code[i] if op >= HAVE_ARGUMENT: arg = code[i+1] | extended_arg extended_arg = (arg << 8) if op == EXTENDED_ARG else 0 else: arg = None extended_arg = 0 yield (i, op, arg)