[Twisted-Python] Problem with runInteraction and passing a dict variable

Ron Arts ron.arts at netland.nl
Sun Oct 29 14:57:21 EST 2006


Hello,

I am both a python and twisted beginner, but I think I have found
a problem in twisted. See the code below.
The handle_PeerStatus function receives a dict wich contains
some info. Then it calls runInteraction with that variable.
When the UpdatePeerStatus function is run, block is empty.

I did some investigating, it seems that UpdatePeerStatus is
run using a workerthread which takes it values from a Queue.

When the dict is pushed onto the Queue, it is valid, when
when it is popped by the worker thread, the var is empty.

Can anybody give me tips to solve this? Am I absolutely
missing something and on the wring track or should I enter a bug?

Thanks,
Ron

class .....
     def handle_PeerStatus(self, block):
         print block
         self.db.runInteraction(self.UpdatePeerStatus, block)


     def UpdatePeerStatus(self, txn, block):
         print block # prints {}
         status = block['PeerStatus']  # throws me an exception


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ron.arts.vcf
Type: text/x-vcard
Size: 270 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20061029/1f655a48/attachment.vcf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3403 bytes
Desc: S/MIME Cryptographic Signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20061029/1f655a48/attachment.bin 


More information about the Twisted-Python mailing list