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

Skip to content

Commit 2b49bed

Browse files
committed
Use resource string to get graphWidgets.js
1 parent e718e08 commit 2b49bed

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plotly/widgets/graph_widget.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
from IPython.display import Javascript, display
1010

1111
from plotly import utils
12+
from pkg_resources import resource_string
1213

1314
# Load JS widget code
1415
# No officially recommended way to do this in any other way
1516
# http://mail.scipy.org/pipermail/ipython-dev/2014-April/013835.html
1617
directory = os.path.dirname(os.path.realpath(__file__))
1718
js_widget_file = os.path.join(directory, 'graphWidget.js')
18-
with open(js_widget_file) as f:
19-
js_widget_code = f.read()
19+
js_widget_code = resource_string('plotly',
20+
'widgets/graphWidgets.js').decode('utf-8')
2021

2122
display(Javascript(js_widget_code))
2223

0 commit comments

Comments
 (0)