RE: [Zope] Re: Saving Pipe3 object
The underscore prefix should be enough: Your variable can be named _long_R_Pipe and it won't be pickled. DC uses the _v_ prefix convention for various stuff, possibly meaning "value"... Who knows. -- Alexander Staubo http://www.mop.no/~alex/ "QED?" said Russell. "It's Latin," said Morgan. "It means, 'So there you bastard'." --Robert Rankin, _Nostramadus Ate My Hamster_
-----Original Message----- From: Li Dongfeng [mailto:mavip5@inet.polyu.edu.hk] Sent: 26. august 1999 15:13 To: ZOPE List Subject: [Zope] Re: Saving Pipe3 object
I have solved this problem. Giving an non-persistent attribute a name starting with "_v_" can avoid pickling it. So I used setattr(self, "_v_long_R_Pipe", long_R) and the attribute can be access outside of the defining method.
Li Dongfeng wrote:
I'm using ZOPE to develope a statistics server using R(a GPLed statistical software). For this, I started the R executable with popen2.Popen in an external method, but I need to exit the method without shutting down the pipe, so I used setattr(self, "some_name", the_pipe) to save the Pipe3 object as an attribute, and got an error message: Object unpicklable.
I understand a open pipe cannot be restored from a file, but can I save the Pipe3 object reference somewhere in the running ZOPE's name space without pickling? Then I can use it in other method to control the running R process.
This is a general problem if you want to use Zope to control other long-running processes.
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
At 04:30 AM 8/27/99 +0200, Alexander Staubo wrote:
The underscore prefix should be enough: Your variable can be named _long_R_Pipe and it won't be pickled.
DC uses the _v_ prefix convention for various stuff, possibly meaning "value"... Who knows.
It stands for 'volatile'. In other words, the opposite of 'persistent'. _v_ attributes are not stored as part of an object's persistent state in the database. It's used for things which should only exist while the object is loaded into memory.
Alexander Staubo wrote:
The underscore prefix should be enough: Your variable can be named _long_R_Pipe and it won't be pickled.
I have tried this suggestion and the "UnPickleableError" appeared again.
DC uses the _v_ prefix convention for various stuff, possibly meaning "value"... Who knows.
_v_ means "volatile". See ZOPE ODB3 guide.
-- Alexander Staubo http://www.mop.no/~alex/ "QED?" said Russell. "It's Latin," said Morgan. "It means, 'So there you bastard'." --Robert Rankin, _Nostramadus Ate My Hamster_
-----Original Message----- From: Li Dongfeng [mailto:mavip5@inet.polyu.edu.hk] Sent: 26. august 1999 15:13 To: ZOPE List Subject: [Zope] Re: Saving Pipe3 object
I have solved this problem. Giving an non-persistent attribute a name starting with "_v_" can avoid pickling it. So I used setattr(self, "_v_long_R_Pipe", long_R) and the attribute can be access outside of the defining method.
Li Dongfeng wrote:
I'm using ZOPE to develope a statistics server using R(a GPLed statistical software). For this, I started the R executable with popen2.Popen in an external method, but I need to exit the method without shutting down the pipe, so I used setattr(self, "some_name", the_pipe) to save the Pipe3 object as an attribute, and got an error message: Object unpicklable.
I understand a open pipe cannot be restored from a file, but can I save the Pipe3 object reference somewhere in the running ZOPE's name space without pickling? Then I can use it in other method to control the running R process.
This is a general problem if you want to use Zope to control other long-running processes.
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
Alexander Staubo wrote:
The underscore prefix should be enough: Your variable can be named _long_R_Pipe and it won't be pickled.
This is incorrect.
DC uses the _v_ prefix convention for various stuff, possibly meaning "value"... Who knows.
The default __getstate__ method, inherited from Persistent excludes any attributes with names beginning with '_v_' or '_p_'. The 'v' stands for volatile. The prefix '_p_' is reserved for attributes used by the database. Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (4)
-
Alexander Staubo -
Jim Fulton -
Li Dongfeng -
Phillip J. Eby