Reputation: 5391
I have a django application running under twisted. I have server.py with the following code: http://slexy.org/view/s21TBxGPut When I run server.py with twisted I get the following exception: http://slexy.org/view/s2WqQDMvsh
The exception is caused by the last 2 lines in server.py. If I comment these lines, I have no exception. I have no idea how to debug such thing. Maybe someone has an idea what am I doing wrong?
Thanks a lot, Arshavski Alexander.
Upvotes: 2
Views: 190
Reputation: 48325
Your TimerService
is constructed wrong:
ts2 = TimerService(3600, call_command("tamarin_pull_logs"))
This is the same as:
some_func = call_command("tamarin_pull_logs")
ts2 = TimerService(3600, some_func)
What does call_command
return? It's not part of your paste, but since your exception is:
exceptions.TypeError: 'NoneType' object is not callable
I'm going to guess that it returns None
. And None
is not callable, as the exception points out.
You set up the first TimerService
correctly:
ts = TimerService(86400, check_all_notifications)
Notice that you're not calling check_all_notifications
in that statement. You're passing it to TimerService
. You need to do the same for your other service:
ts2 = TimerService(3600, call_command, "tamarin_pull_logs")
It just so happens that TimerService
is constructed to support calling a function with some arguments, so it accepts both the callable and arbitrary extra arguments and passes those arguments on to the callable whenever it is time to call it.
Upvotes: 2