Page 1 of 1

uninstall and uninstallstring

Published: September 28, 2016 - 1:11 PM
by Stenon
Hi,

here's my setup.py code.

It's a batch file for installation and it works fine. I'm also trying to run an uninstallation with a batch file, and it's crashing...

which should I use, uninstall or uninstallstring? Thanks for your help!

from setuphelpers import *
uninstallkey = []
uninstallstring = [u'"C:\\FirewallRemoveEsetRule.bat"']

def install():
run(r'"FirewallAddEsetRule.bat"')

def uninstall():
run(u'"FirewallRemoveEsetRule.bat"')

and errors:
2016-09-28 15:09:00,963 WARNING Warning: CalledProcessError: Command '(u'"C:\\FirewallRemoveEsetRule.bat"',)' returned non-zero exit status 1
2016-09-28 15:09:00,986 CRITICAL Error running uninstall script: Command '(u'"FirewallRemoveEsetRule.bat"',)' returned non-zero exit status 1
=== Removed packages ===
allowesetinstall
=== Error removing packages ===
allowesetinstall

Re: uninstall and uninstall string

Published: April 10, 2017 - 4:32 PM
by Nathanael
Hello,
have you found a solution to this question since then?
Nathanael

Re: uninstall and uninstall string

Published: April 10, 2017 - 4:58 PM
by agauvrit
Good morning,
Stenon wrote:

Code: Select all

from setuphelpers import *
uninstallkey = []
uninstallstring = [u'"C:\\FirewallRemoveEsetRule.bat"']

def install():
    run(r'"FirewallAddEsetRule.bat"')

def uninstall():
    run(u'"FirewallRemoveEsetRule.bat"')

During installation, your *.bat script runs correctly, no problem, since it's included in your package (I assume?)

The uninstall, however, fails because at no point in the install function do you copy and paste this script to the root of the C:\ drive

If you want this to work, use a file copy with the function filecopytowhich will allow you to call your script FirewallRemoveEsetRule.bat during uninstallation.

The source code would then become:

Code: Select all

from setuphelpers import *
uninstallkey = []

def install():
    run(r'"FirewallAddEsetRule.bat"')
    filecopyto("FirewallRemoveEsetRule.bat","C:\\")

def uninstall():
    run(u'"C:\\FirewallRemoveEsetRule.bat"')
Sincerely,

Alexander

Re: uninstall and uninstall string

Published: April 22, 2017 - 12:55 PM
by Stenon
Thanks,

in the meantime I had created a second wapt package that called remove.bat.

But a big THANK YOU for your explanation and your clear answer!

PS: The livecast video was very, very good; we seem to know you better now.