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

Matplotlib doesn't produce plots when scripts run in tmux-CLI #1

Open
anmolkabra opened this issue Aug 9, 2017 · 0 comments
Open

Comments

@anmolkabra
Copy link
Owner

When running in tmux in the Command Line Interface (X switched off), Matplotlib dumps core while generating plots, raising this error:

QXcbConnection: Could not connect to display ':0'

Not a big problem as testing in CLI, after detaching from tmux, is fine. The code works like this:

try:
    os.environ["DISPLAY"]
except KeyError as e:
    matplotlib.use("Agg")

which should force matplotlib to not use a GUI backend when running in CLI. os.environ["DISPLAY"] raises a KeyError in this case. However, when the scripts are run from a tmux session in the CLI, os.environ["DISPLAY"] outputs ":0" (the monitor's variable) instead of raising the KeyError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant