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

MAINT: Do not install matplotlib backend without DISPLAY #132

Merged
merged 2 commits into from
May 31, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/source/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Bugfixes
a missing experiment file. (#126)
- Prevent duplicate names in `tree_namespace` from breaking the tree.
Show a relevant warning message. (#128)
- Do not configure the ``matplotlib`` backend for IPython if a user does not
have a valid ``$DISPLAY`` environment variable. The most common case of this
is if X-Forwarding is disabled. (#132)

v0.5.0 (2018-05-08)
===================
Expand Down
10 changes: 8 additions & 2 deletions hutch_python/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,14 @@ def hutch_ipython_embed(stack_offset=0):
# + stack_offset for extra levels between this call and user space
shell = InteractiveShellEmbed.instance()
init_ipython_logger(shell)
shell.enable_matplotlib()
plt.ion()
# Only enable matplotlib Qt backend if we have a DISPLAY
if os.getenv("DISPLAY"):
shell.enable_matplotlib()
plt.ion()
else:
logger.warning("No DISPLAY enviornment variable detected. "
"Methods that create graphics will not "
"function properly.")
# Add our Bug Reporting Magic
logger.debug('Registering bug_report magics')
shell.register_magics(BugMagics)
Expand Down