stuck on setup.py => uninstall()

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
candau
Messages: 2
Registration: February 15, 2016 - 6:29 PM

February 15, 2016 - 6:40 PM

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.
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

February 15, 2016 - 7:53 PM

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
Tranquil IT
candau
Messages: 2
Registration: February 15, 2016 - 6:29 PM

February 17, 2016 - 6:56 PM

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.
Floflobel
Messages: 135
Registration: Oct 15, 2015 - 5:32 p.m.

February 19, 2016 - 12:13 AM

The code is executed with a system account, so there shouldn't be any UAC issues
Jules
Messages: 5
Registration: Apr 22, 2016 - 09:33

April 29, 2016 - 12:43

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.
Stenon
Messages: 36
Registration: June 2, 2016 - 8:04 AM

June 5, 2016 - 09:22

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..
Locked