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

Execute the script with run_name == "__main__" #35

Open
pstjohn opened this issue Sep 6, 2024 · 0 comments · May be fixed by #36
Open

Execute the script with run_name == "__main__" #35

pstjohn opened this issue Sep 6, 2024 · 0 comments · May be fixed by #36

Comments

@pstjohn
Copy link

pstjohn commented Sep 6, 2024

It would be helpful if scripts executed via mkdocs-gen-files could put in a if __name__ = "__main__" guard clause so they don't run if they're imported from elsewhere.

Currently that doesn't work, because runpy defaults to a run name of "<run_path>"

runpy.run_path(file_name)

@pstjohn pstjohn linked a pull request Sep 6, 2024 that will close this issue
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 a pull request may close this issue.

1 participant