0

我正在尝试使用“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

为什么我在尝试卸载新版本时收到“访问被拒绝”错误,我该如何卸载新版本?

4

0 回答 0