Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44b564f

Browse files
committed
FIX
1 parent 2cdcfe7 commit 44b564f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

lib/matplotlib/rcsetup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import operator
2121
import os
2222
import re
23+
import sys
2324

2425
import numpy as np
2526

@@ -187,12 +188,10 @@ def _validate_date_int_mult(s):
187188
if s is None:
188189
return
189190
s = validate_bool(s)
190-
try:
191-
import matplotlib.dates as mdates
191+
# only do this if dates is already imported...
192+
mdates = sys.modules.get("matplotlib.dates")
193+
if mdates:
192194
mdates._rcParam_helper.set_int_mult(s)
193-
except Exception:
194-
# this can fail at import because mdates ends up as a circular import.
195-
pass
196195

197196

198197
def _validate_tex_preamble(s):

0 commit comments

Comments
 (0)