Page 1 of 1

stuck on setup.py => uninstall()

Published: February 15, 2016 - 6:40 PM
by candau
Hello,

I'm stuck on the uninstallation part of a Windows 7 32-bit program.
Here's my code:

# works
# the program uninstalls correctly + the license file and its directory tree in ProgramData
print('uninstalling the software')
run(r'"C:\Program Files\rep 1\rep2\Uninstall.exe" /S')
remove_tree(r'C:\ProgramData\rep3')

# doesn't work
remove_desktop_shortcut('toto.lnk')
remove_programs_menu_shortcut('toto.lnk')
remove_tree(r'C:\Program Files\rep 1')

1/ I can't remove the shortcut from the desktop and the Start Menu
. 2/ remove_tree worked fine for C:\ProgramData but won't do anything for C:\Program Files
(permissions issue?).

Any ideas are welcome :-)

. Thank you.

Re: Stuck on setup.py => uninstall()

Published: February 15, 2016 - 7:53 PM
by htouvet
Locks on files...?
try with

Code: Select all

  remove_tree(r'C:\Program Files\rep 1',ignore_errors=False)
and set the loglevel to debug

wapt-get -l debug remove mypackage

Re: Stuck on setup.py => uninstall()

Published: February 17, 2016 - 6:56 PM
by candau
Hello,
there's nothing conclusive in the log.
I think the problem isn't with the wapt/python code but with Windows 7's UAC.
Thanks.

Re: Stuck on setup.py => uninstall()

Published: February 19, 2016 - 12:13 AM
by Floflobel
The code is executed with a system account, so there shouldn't be any UAC issues

Re: Stuck on setup.py => uninstall()

Published: April 29, 2016 - 12:43 PM
by Jules
I'm a bit late to the party, but I've also done some testing.
And I also can't delete files located in folders like "Windows" or "Program Files".
However, if they're in other directories, everything works correctly.

Re: Stuck on setup.py => uninstall()

Published: June 5, 2016 - 09:22
by Stenon
Hi,

I'm continuing this ticket... I'm also having trouble removing the icons and the Start menu, and here's my setup.py:

# -*- coding: utf-8 -*-
from setuphelpers import *

uninstallkey = ["{A41EB7B5-8883-4795-A587-AAD8A84A010D}"]

def install():
print('installing soft-cisco-anyconnect')
run(r'"anyconnect-win-3.0.08057-web-deploy-k9.exe" /q /norestart')

destdir = makepath(programfiles32,'Cisco AnyConnect Secure Mobility Client')
destdir2 = makepath(programfiles32,'Cisco AnyConnect VPN Client')

def uninstall():
print("Remove start link")
run(r'"C:\Program Files\Cisco\Cisco AnyConnect Secure Mobility Client\Uninstall.exe" -remove')
remove_user_desktop_shortcut('Cisco AnyConnect Secure Mobility Client.lnk')
remove_desktop_shortcut('Cisco AnyConnect Secure Mobility Client.lnk')
remove_file(makepath(start_menu(1),'Cisco AnyConnect Secure Mobility Client.lnk'))
print("Remove directory content %s" % destdir)
remove_tree(destdir)
remove_tree(destdir2)
print("Unregister app from registry")
unregister_uninstall('Cisco AnyConnect Secure Mobility Client',False)
print("Uninstall successful")

=> remove tree works fine but on the other hand remove shortcut does not work

Thank you for your help..