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

User getattr for getting reloader package #1601

Merged
merged 2 commits into from Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
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
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