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.