Discord-S.C.U.M
Discord-S.C.U.M copied to clipboard
Trying to pack into a EXE
File "discum\importmanager.py", line 10, in func KeyError: 'SuperProperties'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "1.py", line 7, in
pyinstaller --noconfirm --onefile --console --add-data "/Images;Images/" "/1.py"
note the path is correct above
Pyinstaller isn't looking in the right place for dependencies, some things you can try:
tell pyinstaller where discum is:
--paths "/full_path_to/venv/lib/python3.x/site-packages/discum/"
tell pyinstaller where discum.start is:
--paths "/full_path_to/venv/lib/python3.x/site-packages/discum/start"
tell pyinstaller to collect everything under discum package:
--collect-all "discum"
tell pyinstaller to collect discum.start as a hidden import:
--hidden-import "discum.start"
if those don't solve it, there are some more exotic options like adding a runtime-hook that imports the discum package and initializes your script, or making discum into a shared library and adding it to the compiled exe and modifying your script to call the functions from the library.
But probably one of the above options, or some combination of those options, will fix it. In all likelihood you just need to tell pyinstaller where to look for dependencies. Also make sure you're running pyinstaller from the same virtual environment where discum is installed. And also on that note, sometimes it can help to make a fresh virtual environment and install the dependencies for your script in the fresh virtual environment, and then install and run pyinstaller in the same environent after dependencies are installed.
Pyinstaller can be finicky sometimes and there are multiple ways you can accomplish the same thing which is kind of annoying and unpythonic but with some experimentation you can usually find a way that works for your situation. Also you might want to consider using the auto-py-to-exe package to initialize pyinstaller, it has some advantages like being able to see all the different options for collecting dependencies so you can try them all systematically in a more organized way, and it gives you verbose output by default. In general it just makes troubleshooting easier.
Hope this helps.