Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

Calling other scripts in PyPi package

$
0
0

I have a python package that I have uploaded to PyPi. The script calls two additional R scripts to run. I have verified that the required R scripts are also uploaded to PyPi (by physically downloading the latest version and seeing them present in the directory). I also can successfully install and run the main python script.

However, I am having trouble figuring out how to call the R scripts from within the python script. That is, what directory structure do I use? Here is the command I use to run:

$ python_script -f file1.txt -g file2.txt

and I get this error:

Fatal error: cannot open file 'script.r': No such file or directory

In the python script, here is how I am calling the R script:

cmd = [ 'Rscript', 'python_script/Rscript.r' ]
    output = subprocess.Popen(cmd, stderr=subprocess.PIPE).communicate()
    result = output[1].decode('utf-8')

But nothing I try works: I've tried just 'Rscript.r' and './Rscript.r'

I'm at a loss as to how to correctly call this script. It is in the same directory as the main python_script I am running.


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>