我有一个Python 3.5脚本,可以从另一台Linux服务器获取信息。它必须首先通过443端口连接以建立连接。不幸的是我收到了以下错误消息:
我可以ping Linux服务器,但会收到以下错误:
Traceback (most recent call last):
File "/opt/saddlesum/webapp_Py3/lib/python3.5/site- packages/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/opt/saddlesum/webapp_Py3/lib/python3.5/site- packages/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/opt/saddlesum/webapp_Py3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 761, in _validate_conn
conn.connect()
File "/opt/saddlesum/webapp_Py3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 204, in connect
conn = self._new_conn()
File "/opt/saddlesum/webapp_Py3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 134, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/opt/saddlesum/webapp_Py3/lib/python3.5/site-packages/requests/packages/urllib3/util/connection.py", line 88, in create_connection
raise err
File "/opt/saddlesum/webapp_Py3/lib/python3.5/site-packages/requests/packages/urllib3/util/connection.py", line 78, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
答案 0 :(得分:1)
问题是由我/ etc / hosts文件中的重复IP地址引起的。删除错误的条目后,一切都开始工作了。