我有一个R脚本,用于生成几个图形。我想要能够从Python中执行这个脚本。
我首先尝试了以下内容:
import subprocess
subprocess.call("/.../plottingfile.R", shell=True)
这给了我以下错误:
/bin/sh: /.../plottingfile.R: Permission denied
126
我不知道数字126代表什么。所有我的文件都在桌面上,所以我认为不需要任何特殊的权限?我认为这个错误可能与cwd = none有关,但我已经更改了它,仍然出现错误。
接下来,我尝试了以下操作:
subprocess.Popen(["R --vanilla --args </.../plottingfile.R>"], shell = True)
但这也给我带来了一个错误:
/bin/sh: Syntax error: end of file unexpected.
最近我尝试了:
subprocess.Popen("konsole | /.../plottingfile.R", shell = True)
这打开了一个新的 konsole 窗口,但没有运行任何 R 脚本。此外,我收到了以下错误:
/bin/sh: /.../plottingfile.R: Permission denied
感谢。