Skip to content

Commit

Permalink
Launch user scripts with run_name == "__main__"
Browse files Browse the repository at this point in the history
Launches the user-provided scripts with a more canonical `__name__` parameter.
  • Loading branch information
pstjohn committed Sep 6, 2024
1 parent 7baa032 commit e9804f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mkdocs_gen_files/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def on_files(self, files: Files, config: MkDocsConfig) -> Files:
with FilesEditor(files, config, self._dir.name) as ed:
for file_name in self.config.scripts:
try:
runpy.run_path(file_name)
runpy.run_path(file_name, run_name="__main__")
except SystemExit as e:
if e.code:
raise PluginError(f"Script {file_name!r} caused {e!r}")
Expand Down

0 comments on commit e9804f1

Please sign in to comment.