Skip to content

Commit 1dff056

Browse files
committed
Wrap import to raise a helpful error.
1 parent fa5937a commit 1dff056

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: plotly/graph_objs/graph_objs_tools.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
import os
55
import sys
66
if sys.version[:3] == '2.6':
7-
from ordereddict import OrderedDict
8-
import simplejson as json
7+
try:
8+
from ordereddict import OrderedDict
9+
import simplejson as json
10+
except ImportError:
11+
raise ImportError(
12+
"Looks like you're running Python 2.6. Plotly expects newer "
13+
"standard library versions of ordereddict and json. You can "
14+
"simply upgrade with these 'extras' with the following terminal "
15+
"command:\npip install 'plotly[PY2.6]'"
16+
)
917
else:
1018
from collections import OrderedDict
1119
import json

0 commit comments

Comments
 (0)