i am using windows 7, R version 3.2.2, python 2.7. pyExecfile throws error of not finding the file even though the file exists.
>library(PythonInR) Warning message: package ‘PythonInR’ was built under R version 3.2.5 > pyConnect() Initialize Python Version 2.7.10 (default, Aug 21 2015, 14:42:12) [MSC v.1500 32 bit (Intel)] > file.exists("C:\\temp\\testPy.py")  TRUE > pyExecfile("C:\\temp\\testPy.py") Traceback (most recent call last): File "<string>", line 1, in <module> IOError : [Errno 2] No such file or directory: 'C:\temp\testPy.py' Error in pyExecp(sprintf("execfile('%s')", as.character(filename))) : An error has occured while executing Python code. See traceback above.
The above error happens to windows only. It works fine on Linux.
To find an alternative, I tried the following on both Windows and Linux and it just caused R to terminate:
>myExec = pyFunction("execfile") >myExec("<pathToPyFile>") *** caught segfault *** address 0x8, cause 'memory not mapped' Traceback: 1: .Call("py_call_obj", callableObj, args, kwargs, simplify, autoTypecast) 2: pyCall("execfile", args = xargs, kwargs = xkwargs) 3: myExec("<pathToPyFile>") Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection:
Is this an issue with pyExecfile for windows? What are the alternatives to execute an ,py file in R?