我正在尝试使用“app.uninstall_version(v)”卸载esky中的版本,但是当我这样做时,我收到此错误:
[Error 5] Access is denied.
Traceback (most recent call last):
File "Example.py", line 35, in EskyUpdate
File "esky\__init__.pyc", line 951, in uninstall_version
File "esky\__init__.pyc", line 1008, in _cleanup_bootstrap_env
File "esky\fstransact\win32txf.pyc", line 200, in remove
File "esky\fstransact\win32txf.pyc", line 214, in _remove
File "esky\fstransact\win32txf.pyc", line 24, in wrapper
WindowsError: [Error 5] Access is denied.
我的程序安装了一个新版本的程序,并在另一个进程中打开新版本,然后等待其退出代码。
如果退出代码等于0,则它会重新启动以使新版本运行,但如果退出代码不等于0(意味着新版本中存在错误),则程序将删除新版本并继续正常运行。
这是代码:
def EskyUpdate():
if getattr(sys,"frozen",False):
app = esky.Esky(sys.executable,"http://example.com/downloads/")
updateVersion = app.find_update()
if(updateVersion != None):
app.fetch_version(updateVersion)
app.install_version(updateVersion)
appexe = esky.util.appexe_from_executable(sys.executable)
exitCode = subprocess.call(appexe)#calls the new version in a different process
if exitCode == 0:
os.execl(appexe, *([appexe]+sys.argv))
else:
app.uninstall_version(updateVersion)#this is where the error occurs
当我尝试卸载新版本时,为什么会出现“访问被拒绝”错误,如何卸载新版本?