Hi Barry, I suspect the problem is that QGIS has set up python's console input differently than rpy expects. At the moment, there is no way to tell RPy to do something different with i/o during startup. (After startup you can call set_rpy_output() and set_rpy_input() to provide new i/o handlers.)
As a first pass, try making this change to rpy.py, and see if this solves your problem: > > Index: rpy.py > =================================================================== > --- rpy.py (revision 388) > +++ rpy.py (working copy) > @@ -195,7 +195,8 @@ > > # Default I/O to functions in the 'rpy_io' module > set_rpy_output(rpy_io.rpy_output) > -set_rpy_input(rpy_io.rpy_input) > +print "Skipping initializtion of R console *read* support" > +#set_rpy_input(rpy_io.rpy_input) > if sys.platform != 'win32': > set_rpy_showfiles(rpy_io.rpy_showfiles) > This will prevent R/Rpy from being able to ready *anything* from the console, so be careful. If this works, then you should find out how QGIS sets up Python's console read operation and do the same thing for R/Rpy. -Greg On Jan 2, 2008, at 7:09AM , Barry Rowlingson wrote: > Starting with a fresh Windows XP system I've installed R 2.6.1 and the > latest Rpy and Python 2.5 from binaries. That all works fine together. > > I've also installed Quantum GIS (QGIS) 0.9.1 from released binaries. > QGIS has an embedded python interpreter which gives access to the > geographic data and via C++ SIP bindings. Very nice. It also has a > Python command line console. > > I want to use Rpy from QGIS' python to do statistical analysis on > geographic data. So I start up QGIS, fire up the console, and 'from > rpy > import r'. > > Pretty rapidly R pops up an error dialog from reading the Rconsole > file. The line number given is a blank line in the file. It then > proceeds to error on all the blank lines and four non-blank lines: > > background = White > normaltext = NavyBlue > usertext = Red > highlight = DarkRed > > If I remove the blank lines and comment out those four, it works > fine. > The error is coming from R's SRC/gnuwin32/preferences.c, so it may be > something in the opt.c file not reading right. > > Rpy works fine when called from Python run from CMD or cygwin > shells, > or from the ERIC IDE. R runs fine when called from os.spawnv() from > QGIS' python console. > > I've checked the environment variables in these cases and they're > the > same, so it's not a language setting. I'm stumped. > > Anyone else seen this? Any workarounds? Can I tell Rpy to startup R > with the '--no-Rconsole' option? Any clues or hints as to what I > can do > to see what's going on are welcome... > > I've had this working before, but probably with slightly different > versions. It all works fine on Linux. > > Barry > > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > rpy-list mailing list > rpy-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rpy-list ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list