-
-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: Invalid config value: spinner=... when bundling script with PyInstaller #280
Comments
Humm, I think it is the way I validate the spinner function: alive-progress/alive_progress/core/configuration.py Lines 49 to 51 in aa73aa7
I'm not sure what this pyinstaller makes with the Python source files, but I'm sure this second condition, which ensures the function came from one of my sources, failed. Can you debug it? Just put in your file something like this, between from ..animations import spinner_compiler
print(spinner_compiler.__file__)
print(spinner.__code__.co_name)
print(spinner.__code__.co_filename) |
plain script:
bundled version:
Getting rid of the second condition in ap's venv sources before bundling works. I'm OK with that workaround. Feel free to close the issue if you don't want to come up with a more permanent fix in AP. |
I am also facing this issue and have resorted to using the woraround proposed by @mmatous. parent_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
func_file, _ = os.path.splitext(module_lookup.__file__)
if x.__code__.co_name == inner_name \
and os.path.splitext(os.path.join(parent_dir, x.__code__.co_filename))[0] == func_file:
return x (The 3 times application of dirname is maybe not the optimal setup, but it works in this case) |
Imo we could do away with the entire check. Or check for mandatory attributes/methods/retval/accepted args if truly necessary. Who cares where the function came from? As long as it looks, swims and quacks like duck, it should be accepted and treated like it is one. |
I do. The I think the permanent fix will be to change the |
I'll test it and send a PR with your proposed fix sometime next week. |
I encountered the same problem as described in #123 and applied the solution only to get a different error. I tried the CLI, specfile, and downgrade but the result is the same.
The error:
Example ap.py:
SW:
Gentoo Linux
Python 3.12.6
PyInstaller 6.10.0
alive-progress 3.1.5 (tried 1.6.2)
The text was updated successfully, but these errors were encountered: