【发布时间】:2015-05-20 07:25:37
【问题描述】:
所以,我正在编写一个 python 脚本,它会在脚本开头自动下载更新。好的,那么?因此,当我尝试覆盖它时,它会使用 CodeRunner 2.0.2、IDLE 2.7.9 和 PythonLauncher 给我sh: /Users/<user>/Desktop/<scriptname>.py: Permission denied。这是受影响的代码段:
cwd = os.getcwd()
cwd = (str(cwd) + "/<scriptname>.py")
update = urllib.URLopener()
cwd = str(cwd)
print "Downloading Update..."
update.retrieve("http://<site_domain>/<scriptname>.py",cwd)
time.sleep(1.25)
print "Update Dowloaded! Please Wait..."
time.sleep(2.5)
os.system(cwd)
我觉得这很奇怪,因为人们说它应该覆盖没问题,但是,当没有兄弟.pyc时我觉得很奇怪,这意味着它可能一直在尝试同时读取和写入,更不用说它工作得很好,然后突然失败了。
【问题讨论】:
标签: python python-2.7 download sh permission-denied