--
Carson J. Q. Farmer
ISSP Doctoral Fellow
National Centre for Geocomputation (NCG),
Email: [email protected]
Web:   http://www.carsonfarmer.com/
      http://www.ftools.ca/


--- Begin Message --- Again thanks for taking the time, adjusting the manageR code following Carson's corrections seems to have shown where R is.

But anyone know how to point rpy2\rinterface to win32api.pyd (at least I think that is where the problem is).
Please see below for further details.
Many thanks for any help.
Darren

Carson Farmer wrote:
Darren Norris wrote:
Many thanks Carson,
I added the line to in __init__.py and manageRDialog.py (below), if I added to just the manageRDialog.py I got the same can't find R error. I have now just added to __init__.py and get the python error (see below for full): "ImportError: No module named win32api" ...
hmm, does your usb have it's own python as well, or are you using your system python? If you don't have win32api, you'll probably need to install the PyWin extensions: http://starship.python.net/crew/mhammond/win32/Downloads.html
I am using the system, well I think. At the moment everything is on my laptop ...... The only python I have was installed with the Qgis standalone ....I went to install the PyWin extensions but the installer couldn't find python....So I've just installed python 2.6.2 and the PyWin extensions (from sourceforge). That doesn't help, as I think Qgis (and therefore manageR) uses the python files that came via the Qgis standalone installer?

The python error is now:

File "C:/Program Files/Quantum GIS/./python\rpy2\rinterface\__init__.py", line 39, in
   import win32api
ImportError: No module named win32api

So the problem is now in the rinterface? Does anyone know where the win32api usually is and where rinterface is looking (win32api.pyd is in
"C:\Program Files\Quantum GIS\python\win32" )?
I think the relevant code in rinterface  is:

# Win32-specific code copied from RPy-1.x
if sys.platform == 'win32':
   import win32api
   os.environ['PATH'] += ';' + os.path.join(R_HOME, 'bin')
   os.environ['PATH'] += ';' + os.path.join(R_HOME, 'modules')
   os.environ['PATH'] += ';' + os.path.join(R_HOME, 'lib')


One of the reasons I work with the Renviron.site file is that I switch between R on a USB and R on laptops / desktops. This flexibility is very useful for me and also means I don't require administrator access on computers where I don't have such permission. Would it be possible to have a file selector dialogue so a user can simply "click" the path when manageR / Rpy can't find R? Or maybe a dialogue that says this is the location of R that manageR will use, OK? If not select the location.....
This might be an option, however, even if manageR did have this function, since you don't appear to have the win32 python extensions, it wouldn't matter in this case anyway... I'll see if I can add this in a future release.

I'm sorry I can't be of more help, but please let me know if the above helps at all? Also, see comments below:
You are helping!

****File Specifications******
__init__.py:

import ConfigParser
import os.path
change the above line to 'import os' without the quotes
os.environ['R_HOME'] = "C:\Users\Darren\R\R-2.9.0\bin"
p = ConfigParser.ConfigParser()
here = os.path.join(os.path.dirname(__file__),"config.ini")
p.read(here)

manageRDialog.py:

import ConfigParser
import os.path
same goes for the above line
os.environ['R_HOME'] = "C:\Users\Darren\R\R-2.9.0\bin"
parser = ConfigParser.ConfigParser()
here = os.path.join( os.path.dirname( __file__ ),"config.ini" )
parser.read( here )

Cheers,

Carson



--- End Message ---
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to