Skip to content

feat(import_app): print original exception on AppImportError - #1334

Merged
tilgovi merged 4 commits into
benoitc:masterfrom
ptbrowne:patch-1
Oct 3, 2016
Merged

tilgovi merged 4 commits into
benoitc:masterfrom
ptbrowne:patch-1

Conversation

@ptbrowne

Copy link
Copy Markdown
Contributor

Useful when you have a NameError in the code that creates your app.

Comment thread gunicorn/util.py Outdated
app = eval(obj, mod.__dict__)
except NameError:
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exception(exc_type, exc_value, exc_traceback)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should only be done when debug mode is enabled. If not it can expose some unwanted to externals systems looking at the output.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By debug mode, do you mean checking the logging level ?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptbrowne yes :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please either use star args to avoid locals or explicitly delete the traceback. See #1228.

Comment thread gunicorn/util.py Outdated
app = eval(obj, mod.__dict__)
except NameError:
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exception(exc_type, exc_value, exc_traceback)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please either use star args to avoid locals or explicitly delete the traceback. See #1228.

@tilgovi

tilgovi commented Oct 1, 2016

Copy link
Copy Markdown
Collaborator

@ptbrowne I think this is waiting for very minor changes from you. Please let us know if you will have time to do this.

@ptbrowne

ptbrowne commented Oct 3, 2016

Copy link
Copy Markdown
Contributor Author

@tilgovi, sorry for the wait, it should be ok now :)

@tilgovi

tilgovi commented Oct 3, 2016

Copy link
Copy Markdown
Collaborator

Not a long wait at all, @ptbrowne! I just happened to process this in a batch of commenting on other issues and PRs. I've been high volume, high latency in my attention to Gunicorn lately.

Looks good to me.

@tilgovi
tilgovi merged commit 915c534 into benoitc:master Oct 3, 2016
mjjbell pushed a commit to mjjbell/gunicorn that referenced this pull request Mar 16, 2018
…#1334)

* feat(import_app): print original exception on AppImportError
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 this pull request may close these issues.

3 participants