Skip to content

Commit

Permalink
Merge pull request #1601 from pokoli/reloader_package
Browse files Browse the repository at this point in the history
User getattr for getting reloader package
  • Loading branch information
davidism authored Jul 12, 2019
2 parents 978255d + 7a01660 commit e0de4a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Unreleased
:pr:`1592`
- Work around an issue in some external debuggers that caused the
reloader to fail. :issue:`1607`
- Work around an issue where the reloader couldn't introspect a
setuptools script installed as an egg. :issue:`1600`


Version 0.15.4
Expand Down
4 changes: 3 additions & 1 deletion src/werkzeug/_reloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ 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:
# The value of __package__ indicates how Python was called. It may
# not exist if a setuptools script is installed as an egg.
if getattr(__main__, "__package__", None) is None:
# Executed a file, like "python app.py".
py_script = os.path.abspath(py_script)

Expand Down

0 comments on commit e0de4a4

Please sign in to comment.