[Zope-dev] Thread in ZODB

2004-04-10 Thread Andre Meyer
Hi Zopers

Here is a nice challenge, I hope:

I have a multi-threaded Python application that I want to link to Zope. 
The idea is to provide a Web interface for viewing and editing the state 
of multiple threads running in Python. On thread should be associated 
with Zope and act as the door between the ZServer and the other threads.
Unfortunately, I do not manage to create a reference to a thread in the 
Zope product's main class because the ZODB refuses to add it.
This is the error message when trying to instantiate the product:

Site Error
An error was encountered while publishing this resource.
Error Type: UnpickleableError
Error Value: Cannot pickle type 'thread.lock' objects
And this is the code where it goes wrong:

class Zpyse(SimpleFolder):
 
   meta_type = Zpyse
  
   manage_options = (
   {'label':'Edit', 'action':'manage_main'},
   {'label':'View', 'action':'index_html'}
   )
  
   index_html = PageTemplateFile('zpt/index_html', globals())
  
   def manage_editZpyse(self, title, REQUEST=None):
   Method to edit Zpyse instances.
   self.title = title
   if REQUEST is not None:
   return self.index_html(self, REQUEST)
  
   def __init__(self, id, title):
   # Sender/Receiver Test
   print 'init Zpyse'
   ams = spyse.getAMS()
*   self.za = ams.createThread('ZopeThread', 'ZopeThread', globals())
   qa = ams.createThread('Receiver', 'ReceiverThread', globals())
   sa = ams.createThread('Sender', 'SenderThread', globals())

* only this goes wrong, the other threads are created (without self.).



Is there anybody with a good idea about how to handle this?

thanks a lot in advance
Andre
--
Dr. Andre P. Meyer http://home.hccnet.nl/a.meyer/
TNO FEL Command  Control and Simulation, http://www.fel.tno.nl/div2/
Delft Cooperation on Intelligent Systems, http://www.decis.nl/
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


RE: [Zope-dev] Thread in ZODB

2004-04-10 Thread zope
The same question was asked and answered ~10 days ago. Search google
(1st hit for the error message) and the archives before (cross)post.
http://marc.theaimsgroup.com/?t=10807723155r=1w=2

Sandor

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Andre Meyer
 Sent: Saturday, April 10, 2004 3:34 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [Zope-dev] Thread in ZODB
[...]
 I have a multi-threaded Python application that I want to 
 link to Zope. 
 Site Error
 An error was encountered while publishing this resource.
 Error Type: UnpickleableError
 Error Value: Cannot pickle type 'thread.lock' objects
[...]


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )