[Error] PyInstaller - IndexError: tuple index out of range

2024. 9. 11. 22:08ใ†Computer Info./๐Ÿ˜‹ Python

  PyInstaller๋ฅผ ํ†ตํ•ด ์œˆ๋„์šฐ ์‹คํ–‰ ํŒŒ์ผ์„ ๋งŒ๋“ค๋ ค๊ณ  ํ–ˆ๋”๋‹ˆ ์œ„์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. ์ด ๋ฌธ์ œ๋Š” Python 3.10 ๋ฒ„์ „์— ์žˆ๋Š” ์ด์Šˆ๋ผ๊ณ  ํ•œ๋‹ค.

 

  ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ํŒŒ์ด์ฌ์ด ์„ค์น˜๋˜์–ด์žˆ๋Š” ํด๋”์˜ Lib ํด๋”๋กœ ์ด๋™ํ•œ๋‹ค. ๋งŒ์•ฝ ์„ค์น˜ ํด๋”๋ฅผ ์•Œ ์ˆ˜ ์—†๋‹ค๋ฉด ํ”„๋กฌํ”„ํŠธ ์ฐฝ์„ ์—ด์–ด์„œ ํŒŒ์ด์ฌ ๋Œ€ํ™”ํ˜• ์ธํ„ฐํ”„๋ฆฌํ„ฐ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•œ๋‹ค.

 

C:\Windows\System32>python
Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\sin00\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
>>>

 

์œ„์™€ ๊ฐ™์ด ํŒŒ์ด์ฌ์ด ์„ค์น˜๋˜์–ด์žˆ๋Š” ๊ฒฝ๋กœ๋ฅผ ๋ณด์—ฌ์ค€๋‹ค.

 

์œ„์˜ ๊ฒฝ๋กœ์—์„œ Python310\\Lib ์•ˆ์— ์žˆ๋Š” dis.py ํŒŒ์ผ์„ ์—ด์–ด def _unpack_opargs ๋ฉ”์„œ๋“œ๋ฅผ ๊ฒ€์ƒ‰ํ•œ๋‹ค. 

 

๊ทธ ํ›„ ์ด ํ•จ์ˆ˜๋ฅผ ์œ„์™€ ๊ฐ™์ด ์ˆ˜์ •ํ•œ๋‹ค.

 

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)

 

๊ทธ ํ›„ ๋‹ค์‹œ PyInstaller๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ์œ„์™€ ๊ฐ™์ด ๋ฌธ์ œ์—†์ด ์ƒ์„ฑ๋œ๋‹ค.

 


  1. IndexError: tuple index out of range when I try to create an executable from a python script using auto-py-to-exe
  2. 20์ดˆ๋„ ์•ˆ๊ฑธ๋ฆฌ๋Š” ํŒŒ์ด์ฌ ์„ค์น˜ ๊ฒฝ๋กœ ์•Œ์•„๋‚ด๊ธฐ !! | ํŒŒ์ด์ฌ ์„ค์น˜ ๊ฒฝ๋กœ ํ™•์ธ