Hi all, I wrote a python-com program to be used within an Excel application. This module uses the rpy functionalities! When I run the com-object from a VBA function or procedure, I get the RuntimeError("Couldn't execute the R interpreter R.exe") raised in the module rpy_tools.py. After a simple debugging, I found that the problem lies in the function
" def get_R_VERSION(RHOME=None, force_exec=False): " at line 64. The first "if" statement in this function tries to use the registry to find out the r_version. ==================================================================== if (not RHOME) and (sys.platform == 'win32') and (not force_exec): try: # Use the registry to find where R.dll is import win32api, win32con hkey = win32api.RegOpenKeyEx( win32con.HKEY_LOCAL_MACHINE, "Software\\R-core\\R", 0, win32con.KEY_QUERY_VALUE ) # get the current version rver = win32api.RegQueryValueEx( hkey, "Current Version" )[0] print "found Rversion from the registry", rver win32api.RegCloseKey( hkey ) except: print "Unable to determine R version from the registry." + \ " Trying another method." pass # failover to exec method ==================================================================== The ( not RHOME ) condition is always False. In this case the second step is used to determine the R version by executing R. ==================================================================== if not rver: if (not RHOME) or (not os.path.exists(RHOME)): RHOME = get_R_HOME(force_exec) rexec = os.path.join(RHOME, 'bin', 'R') stat, output = getstatusoutput('"%s" --version' % rexec ) if stat or len(output)<=0: raise RuntimeError("Couldn't execute the R interpreter" + " `%s'.\n" % rexec ) # edd 05 Apr 2006 version = re.search("R +([0-9]\.[0-9]\.[0-9])", output) version = re.search(" +([0-9]\.[0-9]\.[0-9])", output) print "Getting R version by executing directly the R programm", version if not version: raise RuntimeError("Couldn't obtain version number from output\n" "of `R --version'.\n") rver = version.group(1) ==================================================================== The function call --- getstatusoutput('"%s" --version' % rexec ) --- returns an Error and I get the Runtime error mentioned above. The problem lies I think in the os.popen and the combination with Excel. I don't know for the moment why. In order to use Rpy, I just deleted the ( not RHOME ) condition and all my programs are working well. Is this a general problem with Windows Platform?? Any suggestion to avoid changing the rpy_tools code are welcome. Thanks. Fadhel -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list