Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

【daily_job.py】urllib.error.URLError: <urlopen error [Errno -2] Name or service not known> #91

Open
Jning-H opened this issue May 15, 2022 · 0 comments

Comments

@Jning-H
Copy link

Jning-H commented May 15, 2022

`root@5e94f828d2e7:/data/stock/jobs# python daily_job.py
MYSQL_HOST : mysqldb ,MYSQL_USER : root ,MYSQL_DB : stock_data
MYSQL_CONN_URL : mysql+mysqldb://root:mysqldb@mysqldb:3306/stock_data?charset=utf8mb4

######################### hour_int 23

######################### MYSQL_HOST :mysqldb, MYSQL_USER :root, MYSQL_DB :stock_data #########################

######################### begin run <function stat_all at 0x7f0707486dd0> 2022-05-15 23:01:20.807223 #########################
datetime_str: 2022-05-15
datetime_int: 20220515
error : <urlopen error [Errno -2] Name or service not known>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/urllib/request.py", line 1350, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/local/lib/python3.7/http/client.py", line 1281, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1327, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1276, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1036, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 976, in send
self.connect()
File "/usr/local/lib/python3.7/http/client.py", line 948, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/local/lib/python3.7/socket.py", line 707, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/local/lib/python3.7/socket.py", line 752, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/data/stock/libs/common.py", line 171, in run_with_args
run_fun(tmp_datetime_show) # 使用当前时间
File "daily_job.py", line 30, in stat_all
data = ts.top_list(datetime_str)
File "/usr/local/lib/python3.7/site-packages/tushare/stock/billboard.py", line 64, in top_list
if(du.is_holiday(date)):
File "/usr/local/lib/python3.7/site-packages/tushare/util/dateu.py", line 91, in is_holiday
df = trade_cal()
File "/usr/local/lib/python3.7/site-packages/tushare/util/dateu.py", line 83, in trade_cal
df = pd.read_csv(ct.ALL_CAL_FILE)
File "/usr/local/lib/python3.7/site-packages/pandas/util/_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
return _read(filepath_or_buffer, kwds)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 482, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 811, in init
self._engine = self._make_engine(self.engine)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in init
self._open_handles(src, kwds)
File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers/base_parser.py", line 229, in _open_handles
errors=kwds.get("encoding_errors", "strict"),
File "/usr/local/lib/python3.7/site-packages/pandas/io/common.py", line 614, in get_handle
storage_options=storage_options,
File "/usr/local/lib/python3.7/site-packages/pandas/io/common.py", line 312, in _get_filepath_or_buffer
with urlopen(req_info) as req:
File "/usr/local/lib/python3.7/site-packages/pandas/io/common.py", line 212, in urlopen
return urllib.request.urlopen(*args, **kwargs)
File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.7/urllib/request.py", line 1378, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/lib/python3.7/urllib/request.py", line 1352, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
######################### finish 2022-05-15 23:01:20.807223 , use time: 1.9043400287628174 #########################`

@Jning-H Jning-H changed the title urllib.error.URLError: <urlopen error [Errno -2] Name or service not known> 【daily_job.py】urllib.error.URLError: <urlopen error [Errno -2] Name or service not known> May 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant