2
我想在我的应用程序使用rq_scheduler库,这是我的代码:蟒蛇 - 类型错误:“模块”对象不是可调用
import telepot
import sys
import time
import schedule
import datetime
from redis import Redis
from rq_scheduler import Scheduler
scheduler = Scheduler(connection=Redis())
def handle():
print("hello")
def main():
scheduler.enqueue_at(datetime(2017, 9, 11, 22, 41),handle)
if __name__ == '__main__':
main()
,我得到这个: 更新:
Traceback (most recent call last):
File "***\__init__.py", line 22, in <module>
main()
File "***\__init__.py", line 18, in main
scheduler.enqueue_at(datetime(2017, 9, 11, 22, 41),handle)
TypeError: 'module' object is not callable
1-我的错误在哪里?为什么我得到这个?
可能重复https://stackoverflow.com/questions/4534438/typeerror-module-object-is-not-callable – Akash
它必须是'datetime.datetime(...)' – PRMoureu
@Akash在精神上,是的。不过,我会犹豫关闭这个问题的重复。应该有一篇维基百科文章“以他们的模块命名的Python类列表”。 :) – chepner