[Twisted-Python] [twisted-python] a problem about reactor

Albert Brandl albert.brandl at weiermayer.com
Mon Mar 29 08:22:02 MDT 2010


Hi!

On Mon, Mar 29, 2010 at 11:04:25PM +0800, Joson Mandaro wrote:
>    Then it won't write anything into test1.txt. When I deleted
>    "reactor.run()", it will write contents. It is interesting but I don't
>    know why the reactor blocks file writing.

Try the same code in the interpreter and check the content of the
file:

>>> f=open("test.txt", "w") # creates an empty file
>>> f.write("html")         # file is still empty
>>> f.close()               # content is written to the file

Python is nice enough to close the file when it reaches the end of the
script. But this never happens when the last statement is 
reactor.run().

Regards, 

Albert

--
DI Albert Brandl
Weiermayer Solutions GmbH | http://www.weiermayer.com
4813 Altmünster | Abteistraße 12 | Austria 
| Fon: +43(0)720 70 30 14 | Fax: +43 (0) 7612 88081




More information about the Twisted-Python mailing list