Module_six_moves_urllib_parse object has no attribute urlparse when using plot.ly for Python -
i running below code in jupyter:
import plotly.plotly py import plotly.graph_objs go # create random data numpy import numpy np n = 100 random_x = np.linspace(0, 1, n) random_y0 = np.random.randn(n)+5 random_y1 = np.random.randn(n) random_y2 = np.random.randn(n)-5 # create traces trace0 = go.scatter( x = random_x, y = random_y0, mode = 'markers', name = 'markers' ) trace1 = go.scatter( x = random_x, y = random_y1, mode = 'lines+markers', name = 'lines+markers' ) trace2 = go.scatter( x = random_x, y = random_y2, mode = 'lines', name = 'lines' ) data = [trace0, trace1, trace2] # plot , embed in ipython notebook! py.iplot(data, filename='scatter-mode')
i got error result as:
/library/python/2.7/site-packages/requests/packages/urllib3/util/ssl_.py:315: snimissingwarning: https request has been made, sni (subject name indication) extension tls not available on platform. may cause server present incorrect tls certificate, can cause validation failures. more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. snimissingwarning /library/python/2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: insecureplatformwarning: true sslcontext object not available. prevents urllib3 configuring ssl appropriately , may cause ssl connections fail. more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. insecureplatformwarning /library/python/2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: insecureplatformwarning:
a true sslcontext object not available. prevents urllib3 configuring ssl appropriately , may cause ssl connections fail. more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
--------------------------------------------------------------------------- attributeerror traceback (most recent call last) in () 34 35 # plot , embed in ipython notebook! ---> 36 py.iplot(data, filename='scatter-mode')
/library/python/2.7/site-packages/plotly/plotly/plotly.pyc in iplot(figure_or_data, **plot_options) 173 embed_options['height'] = str(embed_options['height']) + 'px' 174 --> 175 return tools.embed(url, **embed_options) 176 177
/library/python/2.7/site-packages/plotly/tools.pyc in embed(file_owner_or_url, file_id, width, height) 407 else: 408 url = file_owner_or_url --> 409 return plotlydisplay(url, width, height) 410 else: 411 if (get_config_defaults()['plotly_domain']
/library/python/2.7/site-packages/plotly/tools.pyc in init(self, url, width, height) 1382 def init(self, url, width, height): 1383 self.resource = url -> 1384 self.embed_code = get_embed(url, width=width, height=height) 1385 super(plotlydisplay, self).init(data=self.embed_code) 1386
/library/python/2.7/site-packages/plotly/tools.pyc in get_embed(file_owner_or_url, file_id, width, height) 313 "\nrun on function more information." 314 "".format(url, plotly_rest_url)) --> 315 urlsplit = six.moves.urllib.parse.urlparse(url) 316 file_owner = urlsplit.path.split('/')[1].split('~')[1] 317 file_id = urlsplit.path.split('/')[2]
attributeerror: 'module_six_moves_urllib_parse' object has no attribute 'urlparse'
i have tried fix via thread
attribute error trying run gmail api quickstart in python
i did
export pythonpath=/library/python/2.7/site-packages
, make sure unset first blank (yes, path exists on mac).i updated
w3lib (1.13.0)
,six (1.10.0)
jupyter 4.0.6 , python 2.7.6
what else go wrong? please help.
i realized picked wrong kernel in jupyter. if pyspark kernel, gave me error. if use python2 or python3 kernel, it's fine.
Comments
Post a Comment