[SOLVED] run(cmd) returns an error

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
Empbilly
Messages: 79
Registration: January 15, 2018 - 8:59 PM

January 28, 2020 - 7:09 PM

Good morning,

code:

Code: Select all

for soft in installed_softwares("NetBeans"):
        try:
            cmd = WAPT.uninstall_cmd(soft['key'])
            if len(cmd) == 2:
                cmd = cmd[0]
            if not '--silent' in cmd:
                cmd = cmd + ' --silent --state {}state.xml'.format(path)
                print(cmd)
                run(cmd)
        except ValueError:
            print('An error occured!')
I'm running a test installation of PyScripter, but the command prompt (cmd) returns the following error:

Code: Select all

CalledProcessErrorOutput: Command 'C:\\Program Files\\NetBeans-11.2\\uninstall.exe --silent --state C:\\ProgramData\\state.xml' returned non-zero exit status 1.
I believe this is due to the fact that he puts "\\" two back bars.

How can I solve it?
Last edited by empbilly on 07 Feb 2020 - 12:29, edited 1 time.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

January 28, 2020 - 8:22 PM

Code: Select all

for soft in installed_softwares("NetBeans"):
        try:
            cmd = WAPT.uninstall_cmd(soft['key'])
            if len(cmd) == 2:
                cmd = cmd[0]
            if not '--silent' in cmd:
                cmd = '"%s" --silent --state "%s"' % (cmd,makepath(path,'state.xml'))
                print(cmd)
                run(cmd)
        except ValueError:
            print('An error occured!')
Can you try this?
Empbilly
Messages: 79
Registration: January 15, 2018 - 8:59 PM

January 29, 2020 - 12:26

Can you try this?
Sorry, I didn't understand your question! :D
...
cmd = '"%s" --silent --state "%s"' % (cmd,makepath(path,'state.xml'))
...
In local execution tests with the psychiatrist, it worked.
Picture

In production, it reinserts the backslashes "\\" into the software path and generates an error.

Code: Select all

CalledProcessErrorOutput: Command '"C:\\Program Files\\NetBeans-11.2\\uninstall.exe" --silent  returned non-zero exit status 1. 
Any ideas?
Empbilly
Messages: 79
Registration: January 15, 2018 - 8:59 PM

January 31, 2020 - 2:50 PM

Any help?
Empbilly
Messages: 79
Registration: January 15, 2018 - 8:59 PM

February 7, 2020 - 12:28

The guys on Reddit are helping me!! Now it's okay!!

Code: Select all

for soft in installed_softwares("NetBeans"):
        try:
            cmd = "{} --silent\
                -J-Dremove.netbeans.installdir=true \
                -J-Dremove.netbeans.userdir=true".format(soft['uninstall_string'])
            print("Uninstall string: {}".format(cmd))
            run(cmd)
        except ValueError:
            print('[ERROR] An error occured!\n')
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 11, 2020 - 5:20 PM

Hi Empbilly,
empbilly wrote: Feb 7, 2020 - 12:28 The guys on Reddit are helping me!! Now it's okay!!

Code: Select all

for soft in installed_softwares("NetBeans"):
        try:
            cmd = "{} --silent\
                -J-Dremove.netbeans.installdir=true \
                -J-Dremove.netbeans.userdir=true".format(soft['uninstall_string'])
            print("Uninstall string: {}".format(cmd))
            run(cmd)
        except ValueError:
            print('[ERROR] An error occured!\n')
Actually it is the same nice people from Tranquil IT keeping an eye on both reddit (for English speaking people) and on this forum (for French speaking people) ;-)

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked