【发布时间】:2018-12-06 16:33:53
【问题描述】:
我编写了一些在 Stream 中使用的脚本。我做了一些,现在我尝试做一个集中我所有脚本的启动器。
我认为我在子流程方面做得很好,但是我在 atm 上遇到了一些困难。
我尝试使用这一行启动脚本:
subprocess.Popen(['python', "E:/path/rocksmith/rocksmith.pyw"], shell=True)
但是 python 给我一个 No such file or directory 错误。 在我想要启动的脚本中(rocksmith.pyw),我用 open() 打开了一些文本文件,我猜 python 找不到 .txt 文件,因为 .txt 不在启动器目录中?
我的目录是这样的:
Launcher folder
- launcher.py
* Script 1 folder
- Script1.py
- text.txt
* Script 2 folder
- Script2.py
- text.txt
* Script 3 folder
- Script3.py
- image.gif
我不知道我的解释是否正确。 我只是想在“超级脚本”中启动一些脚本。
谢谢。
【问题讨论】:
-
你从
print(path.path+"/rocksmith/rocksmith.pyw")看到了什么? -
抱歉,这只是到达rocksmith.pyw E:/path/rocksmith/rocksmith.pyw的绝对路径
-
你的
path.path是什么?它的值是如何赋值的? -
是在尝试运行rocksmith.pyw 时出现“没有这样的文件或目录”,还是在rocksmith.pyw 尝试打开文件时出现?
-
为什么是
shell=True?
标签: python subprocess