【发布时间】:2009-12-18 09:51:52
【问题描述】:
我正在尝试将此脚本写入我的 linux 终端,并且收到以下错误消息:“OSError: [Errno 2] No such file or directory”。谁能帮忙,谢谢
#!/home/build/test/Python-2.6.4
import os, subprocess
# Create a long command line
cmd =[\
"si createsandbox --yes --hostname=be", \
" --port=70", \
" --user=gh", \
" --password=34", \
" --populate --project=e:/project.pj", \
" --lineTerminator=lf new_sandbox"\
]
outFile = os.path.join(os.curdir, "output.log")
outptr = file(outFile, "w")
errFile = os.path.join(os.curdir, "error.log")
errptr = file(errFile, "w")
retval = subprocess.call(cmd, 0, None, None, outptr, errptr)
errptr.close()
outptr.close()
if not retval == 0:
errptr = file(errFile, "r")
errData = errptr.read()
errptr.close()
raise Exception("Error executing command: " + repr(errData))
【问题讨论】:
-
哪一行导致了这个错误?
-
请提供实际的错误回溯和实际的错误信息。
-
这个“si”程序是什么?它看起来很可疑,它在 Linux 脚本中使用了 Windows 文件名 E:/project.pj。它是一个 shell 脚本,还是一个可执行程序?
标签: python