O
O
oshoshh2020-02-11 21:06:25
JavaScript
oshoshh, 2020-02-11 21:06:25

Error in pyowm when starting, how to solve?

the code

import pyowm

owm = pyowm.OWM('e94295eba3a828dda58d599c0c0661f1')

observation = owm.weather_at_place('London,GB')
w = observation.get_weather()
print(w)

Traceback (most recent call last):
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1276, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1004, in _send_output
    self.send(msg)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 965, in send
    self.sock.sendall(data)
ConnectionResetError: [WinError 10054] Удаленный хост принудительно разорвал существующее подключение

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 719, in urlopen
    retries = retries.increment(
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\urllib3\util\retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\urllib3\packages\six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1276, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 1004, in _send_output
    self.send(msg)
  File "C:\Program Files (x86)\Python38-32\lib\http\client.py", line 965, in send
    self.sock.sendall(data)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'Удаленный хост принудительно разорвал существующее подключение', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\pyowm\commons\http_client.py", line 24, in get_json
    resp = requests.get(uri, params=params, headers=headers,
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\requests\adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'Удаленный хост принудительно разорвал существующее подключение', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\python\test.py", line 5, in <module>
    observation = owm.weather_at_place('London,GB')
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\pyowm\weatherapi25\owm25.py", line 231, in weather_at_place
    _, json_data = self._wapi.cacheable_get_json(uri, params=params)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\pyowm\commons\http_client.py", line 87, in cacheable_get_json
    status_code, data = self.get_json(uri, params=params, headers=headers)
  File "C:\Users\тема\AppData\Roaming\Python\Python38\site-packages\pyowm\commons\http_client.py", line 29, in get_json
    raise api_call_error.APIInvalidSSLCertificateError(str(e))
pyowm.exceptions.api_call_error.APIInvalidSSLCertificateError: Exception in calling OWM Weather API.

Reason: ('Connection aborted.', ConnectionResetError(10054, 'Удаленный хост принудительно разорвал существующее подключение', None, 10054, None))

Caused by: None

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew Hecc, 2019-06-02
@Hecc

Use ready-made libraries:
https://www.chartjs.org/ (Easier)
https://d3js.org/ (More complex)
You have a fairly simple chart, there is no point in writing something specific for its implementation.
Well, maybe just for practice, but that's a completely different story)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question