Can I butt in for a moment and ask why we'd even want q() not to exit? There is (unfortunately) no way to create and destroy multiple R sessions, because R doesn't have such a capability. Even if there were, I don't see what q() would have to do with it -- the right API for creating and destroying sessions would be more like my_r = rpy2.R() # ... do stuff with my_r ... del my_r or whatever. There is an rpy2.rinterface.endEmbeddedR() which tries to clean up the R data structures without exiting the process; the only problem is that you can't re-initialize R afterwards.
q() is a function for exiting the process, just like sys._exit or the C exit() function or whatever. If you call any of them the process will exit. This makes sense if you think about it... If you're just worried about users accidentally calling q() and being surprised by the results, it'd be easier to just say r('q <- function(...) { "Don't press the red button!" }') or whatever at startup. In conclusion, I don't get it :-) -- Nathaniel On Sat, Jul 4, 2009 at 2:46 PM, Daniel Yuan<dy...@jhmi.edu> wrote: >> I have just added something in the documentation for 2.1-dev >> http://rpy.sourceforge.net/rpy2/doc-dev/html/callbacks.html#clean-up >> That will hopefully be enough to get you started. > > Still no joy: > > xn...@work:~> python > Python 2.5.2 (r252:60911, Nov 26 2008, 00:44:29) > [GCC 4.0.1 (Apple Inc. build 5490)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import rpy2.rinterface > >>> rpy2.rinterface.initr() > 0 > >>> q = rpy2.rinterface.baseenv['q'] > >>> q() > xn...@work:~> > > The problem is not one of cleaning up the R namespace, as with a > '.Last' or '.Last.sys' function in R (which I don't have), but of > keeping the python interpreter alive after R quits. > > - Daniel > > > ------------------------------------------------------------------------------ > _______________________________________________ > rpy-list mailing list > rpy-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rpy-list > ------------------------------------------------------------------------------ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list