0
ここで回答した質問をスタックで読んで読みましたが、それを修正する方法はまだ分かりません。エラー再開スレッディング。
私は何か喜んで助けます。ここで
は私のコードです:#!/usr/local/bin/python
import threading
class TaskManagmentHandler:
# Handle tasks from server
MINUTES_TO_FIRST_TASK = 5
MINUTES_TO_NORMAL_TASK = 20
MINUTES_TO_FAILED_TASK = 20
global currentAwaitingTime
currentAwaitingTime = MINUTES_TO_FIRST_TASK
def executeTaskFromServer(self):
print ("hi!")
self.currentAwaitingTime = self.MINUTES_TO_NORMAL_TASK
taskThread = threading.Timer(self.currentAwaitingTime, self.executeTaskFromServer())
taskThread.start()
# start normal task after 5 minutes
# start cycled task every 20 minutes (task call itself after 20 minutes)
if __name__ == "__main__":
print ("hello!")
taskThread = threading.Timer(currentAwaitingTime, executeTaskFromServer)
taskThread.start()
そして、ここで私がいるエラーです:私はexecuteTaskFromServer
ですべてのコードをマークし、単に「こんにちは」私は印刷しても
hello!
Exception in thread Thread-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 1082, in run
self.function(*self.args, **self.kwargs)
TypeError: executeTaskFromServer() takes exactly 1 argument (0 given)
Process finished with exit code 0
それでも同じ問題があります。
class TaskManagmentHandler():
でも試しましたが、私の問題は解決しませんでした。