Hello,
I have just started Python a few weeks ago and Plotly today. I ultimately am looking to plot a US county map, but in the getting started phase, I am having issues plotting basic plots. I am using Jupyter Notebook from Anaconda.
I am doing the following code with the then resulting error. I assume it is a basically minor error that I cannot figure out.
import plotly
plotly.tools.set_credentials_file(username=‘jtanguay’, api_key=‘keyinhere’)
import plotly.plotly as py
import plotly.graph_objs as go
trace0 = go.Scatter(
x=[1, 2, 3, 4],
y=[10, 15, 13, 17]
)
trace1 = go.Scatter(
x=[1, 2, 3, 4],
y=[16, 5, 11, 9]
)
data = [trace0, trace1]
py.plot(data, filename = ‘basic-line’, auto_open=True)
ERROR:
Error Traceback (most recent call last)
~\anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
440 try:
–> 441 cnx.do_handshake()
442 except OpenSSL.SSL.WantReadError:
~\anaconda3\lib\site-packages\OpenSSL\SSL.py in do_handshake(self)
1906 result = _lib.SSL_do_handshake(self._ssl)
-> 1907 self._raise_ssl_error(self._ssl, result)
1908
~\anaconda3\lib\site-packages\OpenSSL\SSL.py in _raise_ssl_error(self, ssl, result)
1638 else:
-> 1639 _raise_current_error()
1640
~\anaconda3\lib\site-packages\OpenSSL_util.py in exception_from_error_queue(exception_type)
53
—> 54 raise exception_type(errors)
55
Error: [(‘SSL routines’, ‘ssl3_get_server_certificate’, ‘certificate verify failed’)]
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
600 body=body, headers=headers,
–> 601 chunked=chunked)
602
~\anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
345 try:
–> 346 self._validate_conn(conn)
347 except (SocketTimeout, BaseSSLError) as e:
~\anaconda3\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
849 if not getattr(conn, ‘sock’, None): # AppEngine might not have .sock
–> 850 conn.connect()
851
~\anaconda3\lib\site-packages\urllib3\connection.py in connect(self)
325 server_hostname=hostname,
–> 326 ssl_context=context)
327
~\anaconda3\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir)
328 if HAS_SNI: # Platform-specific: OpenSSL with enabled SNI
–> 329 return context.wrap_socket(sock, server_hostname=server_hostname)
330
~\anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
447 except OpenSSL.SSL.Error as e:
–> 448 raise ssl.SSLError(‘bad handshake: %r’ % e)
449 break
SSLError: (“bad handshake: Error([(‘SSL routines’, ‘ssl3_get_server_certificate’, ‘certificate verify failed’)],)”,)
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
~\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
439 retries=self.max_retries,
–> 440 timeout=timeout
441 )
~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
638 retries = retries.increment(method, url, error=e, _pool=self,
–> 639 _stacktrace=sys.exc_info()[2])
640 retries.sleep()
~\anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
387 if new_retry.is_exhausted():
–> 388 raise MaxRetryError(_pool, url, error or ResponseError(cause))
389
MaxRetryError: HTTPSConnectionPool(host=‘plot.ly’, port=443): Max retries exceeded with url: /clientresp (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘ssl3_get_server_certificate’, ‘certificate verify failed’)],)”,),))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
~\anaconda3\lib\site-packages\plotly\api\v1\utils.py in request(method, url, **kwargs)
81 try:
—> 82 response = requests.request(method, url, **kwargs)
83 except RequestException as e:
~\anaconda3\lib\site-packages\requests\api.py in request(method, url, **kwargs)
57 with sessions.Session() as session:
—> 58 return session.request(method=method, url=url, **kwargs)
59
~\anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
507 send_kwargs.update(settings)
–> 508 resp = self.send(prep, **send_kwargs)
509
~\anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
617 # Send the request
–> 618 r = adapter.send(request, **kwargs)
619
~\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
505 # This branch is for urllib3 v1.22 and later.
–> 506 raise SSLError(e, request=request)
507
SSLError: HTTPSConnectionPool(host=‘plot.ly’, port=443): Max retries exceeded with url: /clientresp (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘ssl3_get_server_certificate’, ‘certificate verify failed’)],)”,),))
During handling of the above exception, another exception occurred:
PlotlyRequestError Traceback (most recent call last)
in ()
15 data = [trace0, trace1]
16
—> 17 py.plot(data, filename = ‘basic-line’, auto_open=True)
~\anaconda3\lib\site-packages\plotly\plotly\plotly.py in plot(figure_or_data, validate, **plot_options)
240 data = fig.get(‘data’, [])
241 plot_options[‘layout’] = fig.get(‘layout’, {})
–> 242 response = v1.clientresp(data, **plot_options)
243
244 # Check if the url needs a secret key
~\anaconda3\lib\site-packages\plotly\api\v1\clientresp.py in clientresp(data, **kwargs)
33
34 url = ‘{plotly_domain}/clientresp’.format(**cfg)
—> 35 response = request(‘post’, url, data=payload)
36
37 # Old functionality, just keeping it around.
~\anaconda3\lib\site-packages\retrying.py in wrapped_f(*args, **kw)
47 @six.wraps(f)
48 def wrapped_f(*args, **kw):
—> 49 return Retrying(*dargs, **dkw).call(f, *args, **kw)
50
51 return wrapped_f
~\anaconda3\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)
204
205 if not self.should_reject(attempt):
–> 206 return attempt.get(self._wrap_exception)
207
208 delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time
~\anaconda3\lib\site-packages\retrying.py in get(self, wrap_exception)
245 raise RetryError(self)
246 else:
–> 247 six.reraise(self.value[0], self.value[1], self.value[2])
248 else:
249 return self.value
~\anaconda3\lib\site-packages\six.py in reraise(tp, value, tb)
691 if value.traceback is not tb:
692 raise value.with_traceback(tb)
–> 693 raise value
694 finally:
695 value = None
~\anaconda3\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)
198 while True:
199 try:
–> 200 attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
201 except:
202 tb = sys.exc_info()
~\anaconda3\lib\site-packages\plotly\api\v1\utils.py in request(method, url, **kwargs)
87 status_code = response.status_code if response else None
88 content = response.content if response else ‘No content’
—> 89 raise exceptions.PlotlyRequestError(message, status_code, content)
90 validate_response(response)
91 return response
PlotlyRequestError: No message
Thank you,
Justin