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

Report actual error when import fails in mplotqueries. #621

Merged
merged 1 commit into from
May 21, 2018

Conversation

p-mongo
Copy link
Contributor

@p-mongo p-mongo commented May 21, 2018

Description of changes

Before:

% ~/.local/bin/mplotqueries ./mongod.log
Traceback (most recent call last):
  File "/home/w/.local/bin/mplotqueries", line 7, in 
    from mtools.mplotqueries.mplotqueries import main
  File "/home/w/.local/lib/python2.7/site-packages/mtools/mplotqueries/mplotqueries.py", line 22, in 
    raise ImportError("Can't import matplotlib. See "
ImportError: Can't import matplotlib. See github.com/rueckstiess/mtools/blob/master/INSTALL.md for instructions how to install matplotlib or try mlogvis instead, which is a simplified version of mplotqueries that visualizes the logfile in a web browser.

OK, let's see what the deal is with matplotlib:

averagest% python
Python 2.7.15 (default, May  1 2018, 05:55:50)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib
<module 'matplotlib' from '/home/w/.local/lib/python2.7/site-packages/matplotlib/__init__.pyc'>
>>>

Hmm, it seems fine. What needs to be done?

After:

% ~/.local/bin/mplotqueries ./mongod.log
Traceback (most recent call last):
  File "/home/w/.local/bin/mplotqueries", line 7, in 
    from mtools.mplotqueries.mplotqueries import main
  File "/home/w/.local/lib/python2.7/site-packages/mtools/mplotqueries/mplotqueries.py", line 27, in 
    "web browser. Error: " + str(e))
ImportError: Can't import matplotlib. See github.com/rueckstiess/mtools/blob/master/INSTALL.md for instructions how to install matplotlib or try mlogvis instead, which is a simplified version of mplotqueries that visualizes the logfile in a web browser. Error: No module named _tkinter, please install the python-tk package

Thanks, helpful error message!

Fixes #620

Testing

Attempt to use mplotqueries on a minimal Debian installation after installing mtools following installation instructions.

O/S testing:

O/S Version(s)
Linux Debian Testing
macOS
Windows

Before:

% ~/.local/bin/mplotqueries ./mongod.log
Traceback (most recent call last):
  File "/home/w/.local/bin/mplotqueries", line 7, in <module>
    from mtools.mplotqueries.mplotqueries import main
  File "/home/w/.local/lib/python2.7/site-packages/mtools/mplotqueries/mplotqueries.py", line 22, in <module>
    raise ImportError("Can't import matplotlib. See "
ImportError: Can't import matplotlib. See github.com/rueckstiess/mtools/blob/master/INSTALL.md for instructions how to install matplotlib or try mlogvis instead, which is a simplified version of mplotqueries that visualizes the logfile in a web browser.

OK, let's see what the deal is with matplotlib:

averagest% python
Python 2.7.15 (default, May  1 2018, 05:55:50)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib
<module 'matplotlib' from '/home/w/.local/lib/python2.7/site-packages/matplotlib/__init__.pyc'>
>>>

Hmm, it seems fine. What needs to be done?

After:

% ~/.local/bin/mplotqueries ./mongod.log
Traceback (most recent call last):
  File "/home/w/.local/bin/mplotqueries", line 7, in <module>
    from mtools.mplotqueries.mplotqueries import main
  File "/home/w/.local/lib/python2.7/site-packages/mtools/mplotqueries/mplotqueries.py", line 27, in <module>
    "web browser. Error: " + str(e))
ImportError: Can't import matplotlib. See github.com/rueckstiess/mtools/blob/master/INSTALL.md for instructions how to install matplotlib or try mlogvis instead, which is a simplified version of mplotqueries that visualizes the logfile in a web browser. Error: No module named _tkinter, please install the python-tk package

Thanks, helpful error message!

Fixes rueckstiess#620
@stennie stennie added this to the 1.4.2 milestone May 21, 2018
@stennie stennie merged commit b9f6db5 into rueckstiess:develop May 21, 2018
@stennie
Copy link
Collaborator

stennie commented May 21, 2018

Thanks @p-mongo !

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

Successfully merging this pull request may close these issues.

3 participants