I run:
Rscript hello_world.R
from my cmd
terminal where the directory is:
C:\Users\Philip\OneDrive\Betting\Capra\Tennis\polgara>
The script runs fine.
However, I want Python to run it and have this small script located in the same directory as above:
import subprocess
subprocess.run(['Rscript', 'hello_world.R'])
However, I get this error when I run it from VS Code:
Exception has occurred: FileNotFoundError
[WinError 2] The system cannot find the file specified
I next tried:
subprocess.run(['Rscript', 'hello_world.R'], shell=True)
But I got:
'Rscript' is not recognized as an internal or external command, operable program or batch file.
For reference I've added the following to my path:
C:\Program Files\R\R-3.6.3\bin\x64
I've just tried running
Rscript hello_world.R
from the cmd
terminal in VS Code which has the following directory set:
(polgara) C:\Users\Philip\OneDrive\Betting\Capra\Tennis\polgara>
This also gives the error:
'Rscript' is not recognized as an internal or external command, operable program or batch file.
Could the (polgara)
at the beginning be the source of my problem? I believe this is my virtual environment...?