Skip to content

Commit

Permalink
修复函数get_czce_daily异常错误信息
Browse files Browse the repository at this point in the history
错误信息如下:
/usr/bin/python2.7 /home/byhankswang/open-source-projects/tushare/test_unittest.py
Traceback (most recent call last):
  File "/home/byhankswang/open-source-projects/tushare/test_unittest.py", line 64, in <module>
    df = dc.get_czce_daily(date="20170926", type="future")
  File "/home/byhankswang/open-source-projects/tushare/tushare/futures/domestic.py", line 156, in get_czce_daily
    if html.find(u'您的访问出错了') >= 0 or html.find('无期权每日行情交易记录') >= 0:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)

Process finished with exit code 1
  • Loading branch information
byhankswang authored Oct 9, 2017
1 parent bea6778 commit 69a9c91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tushare/futures/domestic.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get_czce_daily(date=None, type="future"):
print(ct.CZCE_DAILY_URL % (day.strftime('%Y'),
day.strftime('%Y%m%d')), reason)
return
if html.find(u'您的访问出错了') >= 0 or html.find('无期权每日行情交易记录') >= 0:
if html.find(u'您的访问出错了') >= 0 or html.find(u'无期权每日行情交易记录') >= 0:
return
html = [i.replace(' ','').split('|') for i in html.split('\n')[:-4] if i[0][0] != u'小']
if html[1][0] not in [u'品种月份', u'品种代码']:
Expand Down

0 comments on commit 69a9c91

Please sign in to comment.