[Twisted-Python] Running a reactor in IPython

2 Mar
2004
2 Mar
'04
11:56 a.m.
Hi all,
At my company, we heavily use IPython for debugging and testing. The following code shows, how to run a reactor together with IPython:
from twisted.internet import reactor from twisted.python import threadable threadable.init(1)
import threading class MyThread(threading.Thread): def run(self): print "starting reactor.." reactor.run(installSignalHandlers=False)
if __name__=="__main__": m=MyThread() m.start() from IPython.Shell import IPythonShellEmbed ipshell = IPythonShellEmbed() ipshell() # this call anywhere in your program will start IPython
have fun,
Thorsten
--
brainbot technologies AG
boppstrasse . 64 . 55118 mainz . germany
fon +49 6131 211639-1 . fax +49 6131 211639-2
http://brainbot.com/ mailto:henni@brainbot.com
6967
Age (days ago)
6967
Last active (days ago)
0 comments
1 participants
participants (1)
-
Thorsten Henninger