Skip to content

ModuleNotFoundError exception when IPython in not installed #1241

Closed

Description

@seisman
python ~/bad.py (this is the script posted above)
Traceback (most recent call last):
  File "/Users/pwessel/bad.py", line 2, in <module>
    import pygmt
  File "/Users/pwessel/GMTdev/pygmt/pygmt/__init__.py", line 28, in <module>
    from pygmt.figure import Figure, set_display
  File "/Users/pwessel/GMTdev/pygmt/pygmt/figure.py", line 9, in <module>
    import IPython
ModuleNotFoundError: No module named 'IPython'

Originally posted by @PaulWessel in #732 (comment)

Activity

  1. seisman commented on Apr 26, 2021

    @seisman
    MemberAuthor

    pygmt/pygmt/figure.py

    Lines 8 to 11 in 7466dc3

    try:
    import IPython
    except KeyError:
    IPython = None # pylint: disable=invalid-name

    When IPython is not installed, it raises a ModuleNotFoundError exception, but the code incorrectly checks the KeyError exception.

    We should fix it and ideally add a test.

  2. added
    bug
    help wanted
    on Apr 26, 2021
  3. added this to the 0.4.0 milestone on Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions