Skip to content
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

Fix running scripts with importlib installed. #85

Merged
merged 2 commits into from
Jul 8, 2024
Merged

Conversation

wRAR
Copy link
Member

@wRAR wRAR commented Jul 5, 2024

This fixes a bug introduced in #82 caused by run_script missing in the importlib API. I tested this by deploying a project and running a script shipped by it, both with zip_safe=False and zip_safe=True. Not sure if there are any other things that can be tested, I cannot test the error code path as Dash doesn't allow running non-existent scripts.

raise ValueError(
f"Script {script!r} not found in metadata at {dist._path!r}"
)
script_filename = dist._path.joinpath(script)
Copy link
Member Author

@wRAR wRAR Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a way to avoid accessing _path, though it's used only in the exception above and to get full file paths in tracebacks from the compiled code, which should be fine to truncate to just script as users won't access scripts on the Dash host anyway.

@wRAR wRAR merged commit 190d3ff into master Jul 8, 2024
18 checks passed
@wRAR wRAR deleted the fix-runscript branch July 8, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants