Skip to content

Commit

Permalink
User getattr for getting reloader package.
Browse files Browse the repository at this point in the history
The main __script__ may not have a package when running as setup
scripts

Closes #1600
  • Loading branch information
pokoli committed Jul 5, 2019
1 parent a41a3e0 commit 17d9d83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/werkzeug/_reloader.py
Expand Up @@ -73,7 +73,7 @@ def _get_args_for_reloading():
# Need to look at main module to determine how it was executed.
__main__ = sys.modules["__main__"]

if __main__.__package__ is None:
if getattr(__main__, '__package__', None) is None:
# Executed a file, like "python app.py".
if os.name == "nt":
# Windows entry points have ".exe" extension and should be
Expand Down

0 comments on commit 17d9d83

Please sign in to comment.