Hello all,

 

I believe the rpy doc indicates that there is a way to kill the
connection to R within the script if you are on unix flavored OSs.  I am
looking for a way to do this on windows.  I am working with an
application that runs each python script "In Process", essentially using
PyExecString with a set of predefined local and global dictionaries.
The error that returns is:

 

RuntimeError: Only one R object may be instantiated per session

 

 

>From some other threads on the net I found that this can be duplicated
by:

>>> import rpy

>>> rpy.R()

 

>>  File "C:\Python25\Lib\site-packages\rpy.py", line 346, in 
>>   r = R()

 

I don't know what the best solution is for this.  Should I be looking to
clean this up by hacking something similar to the "stop_r_eventloop"? Or
should the above function be a No Op if R() has already been
initialized.  

 

Our program (ArcGIS) had a similar issue with numpy when we began using
it.  In that case, it happened to be a static variable that was not
cleaned up when we flush the globals and locals after the PyExecString.
Travis O actually set it as a bug and fixed it on their end.

 

The behavior in short, the first time I run a script that is using rpy,
it works beautifully.... The second time it runs, I get the error
listed.  As the locals and globals have been flushed after the first
use, there is no reference to rpy in them or the sys.modules on intial
startup.

 

I appreciate any help with this matter.  Regards,

 

MJ

 

Mark Janikas

Product Engineer

ESRI, Geoprocessing

380 New York St.

Redlands, CA 92373

909-793-2853 (2563)

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to