shinnytech / tqsdk-python

天勤量化开发包, 期货量化, 实时行情/历史数据/实盘交易
https://doc.shinnytech.com/tqsdk/latest
Apache License 2.0
3.63k stars 650 forks source link

DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. #444

Closed jaried closed 2 years ago

jaried commented 2 years ago

tqsdk:'3.2.9' python:3.9.7

https://github.com/shinnytech/tqsdk-python/blob/6b51b4efba798f04196c19b776adac25d66d0bce/tqsdk/channel.py#L47

D:\Anaconda3\lib\site-packages\tqsdk\channel.py:47: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  asyncio.Queue.__init__(self, loop=api._loop) if (py_ver.major == 3 and py_ver.minor < 10) else asyncio.Queue.__init__(self)
D:\Anaconda3\lib\asyncio\queues.py:48: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self._finished = locks.Event(loop=loop)

_2~0VFFIKCBU30HN OYWW9N

shinny-mayanqiong commented 2 years ago

https://docs.python.org/3.9/library/warnings.html

您的运行命令和环境变量有设置相关参数吗?默认情况下, 该 DeprecationWarning 不会抛给用户代码的。

jaried commented 2 years ago

奇怪,我没有设置相关参数反而显示该DeprecationWarning 。 不过,我手工指定了这个就没显示了:

warnings.filterwarnings("ignore", category=DeprecationWarning)