pythonstock / stock

stock,股票系统。使用python进行开发。
Apache License 2.0
6.58k stars 2.21k forks source link

执行初始化数据,报错 socket.gaierror: [Errno -2] Name or service not known #60

Closed lusson-luo closed 1 year ago

lusson-luo commented 3 years ago

初始化执行 sh /data/stock/jobs/cron.daily/run_daily,报错,是周六执行的,容器内有网,访问 baidu.com 可以获得内容

root@447df04d5220:/data# sh /data/stock/jobs/cron.daily/run_daily
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/urllib/request.py", line 1349, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/lib/python3.6/http/client.py", line 1272, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1318, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1267, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1038, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.6/http/client.py", line 976, in send
    self.connect()
  File "/usr/local/lib/python3.6/http/client.py", line 948, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/local/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/local/lib/python3.6/socket.py", line 745, 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 167, in run_with_args
    run_fun(tmp_datetime_show)  # 使用当前时间
  File "/data/stock/jobs/daily_job.py", line 30, in stat_all
    data = ts.top_list(datetime_str)
  File "/usr/local/lib/python3.6/site-packages/tushare/stock/billboard.py", line 64, in top_list
    if(du.is_holiday(date)):
  File "/usr/local/lib/python3.6/site-packages/tushare/util/dateu.py", line 91, in is_holiday
    df = trade_cal()
  File "/usr/local/lib/python3.6/site-packages/tushare/util/dateu.py", line 83, in trade_cal
    df = pd.read_csv(ct.ALL_CAL_FILE)
  File "/usr/local/lib/python3.6/site-packages/pandas/io/parsers.py", line 676, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "/usr/local/lib/python3.6/site-packages/pandas/io/parsers.py", line 431, in _read
    filepath_or_buffer, encoding, compression
  File "/usr/local/lib/python3.6/site-packages/pandas/io/common.py", line 172, in get_filepath_or_buffer
    req = urlopen(filepath_or_buffer)
  File "/usr/local/lib/python3.6/site-packages/pandas/io/common.py", line 141, in urlopen
    return urllib.request.urlopen(*args, **kwargs)
  File "/usr/local/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 1377, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.6/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
^CTraceback (most recent call last):
  File "/data/stock/jobs/18h_daily_job.py", line 82, in <module>
    time.sleep(5)  # 停止5秒
KeyboardInterrupt
qaz1305820192 commented 3 years ago

解决了吗 我也遇到了

IMF0206 commented 3 years ago

兄弟解决了吗?我也是这个问题,用docker hub最新镜像也没找到这个脚本

GunsFireRose911 commented 3 years ago

解决了吗? 同样的问题

lusson-luo commented 3 years ago

这个错误不影响查看数据

IMF0206 commented 3 years ago

这个错误不影响查看数据

但是我运行后存在NOTE: Behavior of MACDH calculation has changed as of July 2017 - it is now 1/2 of previous calculated values的错误,页面打开后没有数据,我看到issue有类似问题,但是我用的是说明中提供的mariadb镜像,是部署包不够新吗?

guoleigl commented 3 years ago

一个文档都写不清楚吗?

HUANGDEHUANG commented 3 years ago

解决了我也遇到了

老哥怎么解决的 求指导。我也是报错 然后出现了截至 2017 年 7 月,MACDH 计算的行为发生了变化 - 现在是以前计算值的错误的 1/2,页面打开后没有数据,我看到问题有类似的问题,

wangzhenhui1992 commented 2 years ago

+1