Skip to content

Commit a1de3e1

Browse files
committed
Merge pull request numenta#3119 from vitaly-krugl/remove-import-error-logging
Suppress optional dependency on matplotlib without logging
2 parents bf38147 + 20dd695 commit a1de3e1

File tree

1 file changed

+6
-5
lines changed
  • src/nupic/research/monitor_mixin

1 file changed

+6
-5
lines changed

src/nupic/research/monitor_mixin/plot.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@
2323
Plot class used in monitor mixin framework.
2424
"""
2525

26-
import logging
2726
import os
2827

2928
try:
3029
# We import in here to avoid creating a matplotlib dependency in nupic.
3130
import matplotlib.pyplot as plt
3231
import matplotlib.cm as cm
3332
except ImportError:
34-
# Suppress; we log it at debug level to avoid polluting the logs of apps
35-
# and services that don't care about plotting
36-
logging.debug("Cannot import matplotlib. Plot class will not work.",
37-
exc_info=True)
33+
# Suppress this optional dependency on matplotlib. NOTE we don't log this,
34+
# because python logging implicitly adds the StreamHandler to root logger when
35+
# calling `logging.debug`, etc., which may undermine an application's logging
36+
# configuration.
37+
plt = None
38+
cm = None
3839

3940

4041

0 commit comments

Comments
 (0)