Pagina 1 di 1

[RISOLTO] run(cmd) restituisce un errore

Pubblicato: 28 gennaio 2020 - 19:09
di empbilly
Buongiorno,

codice:

Codice: Seleziona tutto

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!')
Sto eseguendo un'installazione di prova di PyScripter, ma il prompt dei comandi (cmd) restituisce il seguente errore:

Codice: Seleziona tutto

CalledProcessErrorOutput: Command 'C:\\Program Files\\NetBeans-11.2\\uninstall.exe --silent --state C:\\ProgramData\\state.xml' returned non-zero exit status 1.
Credo che ciò sia dovuto al fatto che mette "\\" due barre posteriori.

Come posso risolverlo?

Re: run(cmd) restituisce un errore

Pubblicato: 28 gennaio 2020 - 20:22
di sfontenau

Codice: Seleziona tutto

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!')
Puoi provare questo?

Re: run(cmd) restituisce un errore

Pubblicato: 29 gennaio 2020 - 12:26
di empbilly
Puoi provare questo?
Mi dispiace, non ho capito la tua domanda! :D
...
cmd = '"%s" --silent --state "%s"' % (cmd,makepath(path,'state.xml'))
...
Nei test di esecuzione locali condotti con lo psichiatra, ha funzionato.
Immagine

In produzione, reinserisce le barre rovesciate "\\" nel percorso software e genera un errore.

Codice: Seleziona tutto

CalledProcessErrorOutput: Command '"C:\\Program Files\\NetBeans-11.2\\uninstall.exe" --silent  returned non-zero exit status 1. 
Avete qualche idea?

Re: run(cmd) restituisce un errore

Pubblicato: 31 gennaio 2020 - 14:50
di empbilly
Hai bisogno di aiuto?

Re: run(cmd) restituisce un errore

Pubblicato: 7 febbraio 2020 - 12:28
di empbilly
I ragazzi di Reddit mi stanno aiutando!! Ora va tutto bene!!

Codice: Seleziona tutto

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')

Re: run(cmd) restituisce un errore

Pubblicato: 11 febbraio 2020 - 17:20
di dcardon
Ciao Empbilly,
empbilly ha scritto: 7 febbraio 2020 - 12:28 I ragazzi di Reddit mi stanno aiutando!! Ora va tutto bene!!

Codice: Seleziona tutto

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')
In realtà sono le stesse brave persone di Tranquil IT che tengono d'occhio sia Reddit (per le persone di lingua inglese) sia questo forum (per le persone di lingua francese) ;-)

Denis