Dear Yaroslav,
Having an embedded R running in "interactive" mode seems needed (and other interfaces to R seem to have it that way, or at least it was the case last time I looked at it). The recommended use of Rf_initEmbeddedR() is setting R_Interactive to TRUE (on UNIX systems, the win32 path is a different story). Because of the limited control over what Rf_initEmbeddedR() was doing (and issues originating from this), rpy2 is no longer using it and you can hack R_Interactive to FALSE easily (line 1015 in rinterface.c for 2-1.dev). I have not experimented much beyond trying to set to FALSE during the R initialization in rpy2 and see that it would somehow run through few examples in a console, but cause it to crash when running the suite of unittests. It would be helpful if you could experiment a bit with that. If setting R_interactive to FALSE is needed, I can add it either as a parameter to rpy2.rinterface.initr() or as a new method (for example rpy2.rinterface.set_interactive(True | False)) Best, L. Yaroslav Halchenko wrote: > Dear RPy Developers, > > Thanks for the product. Within our little PyMVPA (www.pymvpa.org) we use > it to interface with some machine learning methods available in R. Problem > comes whenever R code segfaults -- then regardless either python section is > interactive or not we are presented with R's dialog giving options to save > dump > etc... ie the code > > 00562 if(R_Interactive) { > 00563 REprintf("\nPossible actions:\n1: %s\n2: %s\n3: %s\n4: %s\n", > 00564 "abort (with core dump, if enabled)", > 00565 "normal R exit", > 00566 "exit R without saving workspace", > 00567 "exit R saving workspace"); > 00568 while(1) { > 00569 if(R_ReadConsole("Selection: ", ConsoleBuf, > CONSOLE_BUFFER_SIZE, > 00570 0) > 0) { > 00571 if(ConsoleBuf[0] == '1') break; > 00572 if(ConsoleBuf[0] == '2') R_CleanUp(SA_DEFAULT, 0, 1); > 00573 if(ConsoleBuf[0] == '3') R_CleanUp(SA_NOSAVE, 70, 0); > 00574 if(ConsoleBuf[0] == '4') R_CleanUp(SA_SAVE, 71, 0); > 00575 } > 00576 } > > That stalls unittests which are running overnight, and moreover for some > reason > it fills up stdout (or stderr... didn't check - stderr gets redirected to > stdout) with "Selection: " until disk fills up ;) > > So, the question is -- since embedded R starts with hardcoded > R_Interactive, is there some other way to prevent "interaction" with segfault > 'dialog'? > > In my blind attempt I've tried to do something evil like > > def input1(*args): return "1" # which is "1: abort (with core > dump, if enabled)" > rpy.set_rpy_input(input1) > > which seemed to work at first, but whole battery of unittests started to > puke at some other places with "XXX lineno: 19, opcode: 0" and "SystemError: > unknown opcode" at other places... > > I was using python2.5 and python-rpy 1.0.3-8 (rebuilt with debugging > symbols) on Debian amd64 system. > > Thanks in advance for ideas! ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list