我在从不同的python脚本执行python脚本时遇到问题:
filePath = "C:\Desktop\TestScripts\test.py"
####subprocess.call(filePath, shell = True)
child = subprocess.Popen(filePath, shell=True, stderr=subprocess.PIPE)
while True:
out = child.stderr.read(1)
if out == '' and child.poll() != None:
break
if out != '':
sys.stdout.write(out)
sys.stdout.flush()
当我执行此操作时,我得到:
'C:\Desktop\TestScripts\' is not recognized as an internal or external command,
operable program or batch file.
我无法解释上述错误。如有任何建议,我们将不胜感激。你知道吗
注意,错误是说找不到文件
'C:\Desktop\TestScripts\'
。文件名被截断,因为'\t'
是制表符。你知道吗改用raw string
r'C:\Desktop\TestScripts\test.py'
。你知道吗相关问题 更多 >
编程相关推荐