Skip to content

Commit 38dc8be

Browse files
committed
use os to build path to graph reg JSON files
1 parent 9c2c69a commit 38dc8be

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: plotly/graph_objs/graph_objs_tools.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import absolute_import
22
from plotly import utils
33
import textwrap
4+
import os
45
import sys
56
if sys.version[:3] == '2.6':
67
from ordereddict import OrderedDict
@@ -15,13 +16,17 @@
1516

1617
# Define graph reference loader
1718
def _load_graph_ref():
18-
json_files = ['graph_objs_meta', 'OBJ_MAP',
19-
'NAME_TO_KEY', 'KEY_TO_NAME']
19+
graph_reference_dir = 'graph_reference'
20+
json_files = [
21+
'graph_objs_meta.json',
22+
'OBJ_MAP.json',
23+
'NAME_TO_KEY.json',
24+
'KEY_TO_NAME.json'
25+
]
2026
out = []
2127
for json_file in json_files:
22-
s = resource_string('plotly',
23-
'graph_reference/' +
24-
json_file+'.json').decode('utf-8')
28+
relative_path = os.path.join(graph_reference_dir, json_file)
29+
s = resource_string('plotly', relative_path).decode('utf-8')
2530
tmp = json.loads(s, object_pairs_hook=OrderedDict)
2631
tmp = utils.decode_unicode(tmp)
2732
out += [tmp]

0 commit comments

Comments
 (0)