-
Notifications
You must be signed in to change notification settings - Fork 304
Conversation
@yuyu2172 How about also importing matplotlib in the position of class Hogehoge():
def __init__():
try:
import matplotlib
self.pyplot = matplotlib.pyplot
except:
warn('hogehoge') |
Why do we need to have a module |
i thought the problem is importing the module multiple times. |
_available = True | ||
|
||
except ImportError: | ||
except (ImportError, TypeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any cases that TypeError
is raised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied it from Chainer.
TypeError
is sometimes called when backend is not imported properly.
related
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
I don't think keeping a module as an attribute is good. @yuyu2172's solution looks good and enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Related chainer/chainer#2740
matplotlib
backend can now be configured after importingchainercv
.