Getting the following error when trying to build my application. My code runs smoothly inside VScode (running the python file directly). I've looked online and I can't seem to find anyone who's had this error pop up. It used to happen to me when I wasn't in my virtual environment, but I definitely am now (source venv/bin/activate
). What could it be? Thanks
Traceback (most recent call last):
File "/Users/wiggly/Desktop/twitterBot/setup.py", line 14, in <module>
setup(
^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/distutils/core.py", line 148, in setup
dist.run_commands()
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/distutils/dist.py", line 985, in run_command
cmd_obj.run()
^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 967, in run
self._run()
^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 1197, in _run
self.run_normal()
^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 1294, in run_normal
self.process_recipes(mf, filters, flatpackages, loader_files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 1143, in process_recipes
rval = check(self, mf)
^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/recipes/detect_dunder_file.py", line 54, in check
scan_bytecode_loads(names, node.code)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/recipes/detect_dunder_file.py", line 31, in scan_bytecode_loads
scan_bytecode_loads(names, c)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/recipes/detect_dunder_file.py", line 25, in scan_bytecode_loads
name = co.co_names[inst.arg]
~~~~~~~~~~~^^^^^^^^^^
IndexError: tuple index out of range
I use the default setup.py using the command provided in the docs py2applet --make-setup bot.py
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ["bot.py"]
DATA_FILES = []
OPTIONS = {}
setup(
app=APP,
data_files=DATA_FILES,
options={"py2app": OPTIONS},
setup_requires=["py2app"],
)
The problem is that you have installed a beta version of Python (version 3.11
). And looks like py2app
version 0.28.2
is not compatible with it. Try to uninstall the 3.11
version and install the current release version 3.10
and it should work. Also, recreate the virtual environment after you install it because the current one would still be pointing to the 3.11
version.