【发布时间】:2014-07-31 02:08:48
【问题描述】:
我正在尝试通过传递命令行参数通过 Python 运行 R 脚本。我正在使用这段代码:
proc=subprocess.Popen(["Rscript", "modelcriteria.R", "--args","model_selection_criteria.csv"])
我遇到了这个错误:
Error in file(file, "rt") : cannot open the connection
...
In file(file, "rt") : cannot open file '--args': No such file or directory
Execution halted.
我要做的就是将model_selection_criteria.csv 文件传递给我在Python 环境中的R 脚本。任何人都可以在我的代码中指出问题或提出替代解决方案。
提前致谢。
【问题讨论】:
-
错误本身告诉你真相。尝试删除
"--args" -
是的,谢谢,我已经试过了,现在运行:)
标签: python r command-line subprocess