我正在尝试使用以下代码从根目录打开一个文件“test_msm8974.sh”,即使该文件存在我仍然收到以下错误,是否有更好的方法来实现这个或关于为什么脚本不存在的建议找到了吗?
try:
with open("test_" + target + ".sh") as f: pass
copy("test_" + target + ".sh", BUILD_ROOT_DIR)
except IOError as e:
print "test_" + target + ".sh" + " file missing"
raise
即使文件存在,我也会不断收到以下错误
Traceback (most recent call last):
File "g2g_integration.py", line 612, in <module>
main()
File "g2g_integration.py", line 430, in main
with open("test_" + target + ".sh") as f: pass
IOError: [Errno 2] No such file or directory: 'test_msm8974.sh'