我使用jupyter笔记本,运行twint
代码
c = twint.Config()
c.Username = 'twitter'
c.Limit = 20
twint.run.Followers(c)
上面的命令产生一个运行时错误,与(我相信)试图创建2个异步事件循环的代码有关。 回溯如下:
RuntimeError Traceback (most recent call last)
<ipython-input-4-4713cc05fb59> in <module>()
----> 1 twint.run.Favorites(c)
~/coding/tools/twint/twint/run.py in Favorites(config)
119 def Favorites(config):
120 config.Favorites = True
--> 121 run(config)
122
123 def Followers(config):
~/coding/tools/twint/twint/run.py in run(config)
115
116 def run(config):
--> 117 get_event_loop().run_until_complete(Twint(config).main())
118
119 def Favorites(config):
~/.pyenv/versions/3.6.5/lib/python3.6/asyncio/base_events.py in run_until_complete(self, future)
453 future.add_done_callback(_run_until_complete_cb)
454 try:
--> 455 self.run_forever()
456 except:
457 if new_task and future.done() and not future.cancelled():
~/.pyenv/versions/3.6.5/lib/python3.6/asyncio/base_events.py in run_forever(self)
407 self._check_closed()
408 if self.is_running():
--> 409 raise RuntimeError('This event loop is already running')
410 if events._get_running_loop() is not None:
411 raise RuntimeError(
RuntimeError: This event loop is already running
我已经为Jupyter笔记本找到了解决方案 使用nest\u async
干脆
并添加这些行
相关问题 更多 >
编程相关推荐