Python Forum
[Errno 54] Connection reset by peer
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Errno 54] Connection reset by peer
#1
Not sure if this is the right place, if not please advise.

I try to get Python3 (3.8.6) up and running on a Mac (Catalina 10.15.6). Here is what I did:

- Installed Homebrew: $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebr...er/install)"
- Installed Python3: brew install python3
- Installed Pandas: pip3 install pandas

Entered the following code:
import pandas as pd
url = 'https://statistik.tg.ch/public/upload/assets/94501/COVID19_Fallzahlen_Kanton_TG.csv'
df = pd.read_csv(url)
When executing the code the script stops with the error message "[Errno 54] Connection reset by peer" at the pd.read_csv line.

Tried to figure out where this might come from, found some hints that it might have to do with SSL. Looks like I have both:
 LibreSSL 2.8.3 and OpenSSL 1.1.1h  22 Sep 2020 installed

Appreciate every hint to solve the problem. 

Thank you in advance.


*** full error message ***
 
Traceback (most recent call last):
  File "corona board 01 tk.py", line 16, in <module>
    df = pd.read_csv(url)
  File "/usr/local/lib/python3.8/site-packages/pandas/io/parsers.py", line 686, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/usr/local/lib/python3.8/site-packages/pandas/io/parsers.py", line 434, in _read
    fp_or_buf, _, compression, should_close = get_filepath_or_buffer(
  File "/usr/local/lib/python3.8/site-packages/pandas/io/common.py", line 183, in get_filepath_or_buffer
    req = urlopen(filepath_or_buffer)
  File "/usr/local/lib/python3.8/site-packages/pandas/io/common.py", line 137, in urlopen
    return urllib.request.urlopen(*args, **kwargs)
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1354, in do_open
    r = h.getresponse()
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 54] Connection reset by peer
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Serial connection connection issue Joni_Engr 15 8,417 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  STT: recognition connection failed: [Errno 32] Broken pipe GrahamBerends 0 5,235 Jul-18-2020, 11:00 PM
Last Post: GrahamBerends

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020