command line - python: how to properly pass arguments to executable via commandline -


i'm trying write small python script, allow me pass parameters command line dialog, in order run setup file. want able pass parameters executable file, example: "setup.exe --uninstall --delete-profile --force-uninstall"

i've tried use "os.system" module, "subprocess.call" module, in both cases, script doesn't work.
i'm not getting error. instead, script ends, setup and\or application files , folders not deleted.
when i'm running same commands manually (via commandline), application , relevant files deleted.

here's line of code:

subprocess.call('setup.exe --uninstall --delete-profile --force-uninstall', shell=true) 

i think problem due permissions (though i'm running script via idle admin rights) or "--" symbols, separates arguments (unfortunately, that's format used setup file).

any appreciated.

use :

subprocess.popen(['hostname', '-f'], stdout=subprocess.pipe).communicate()[0] 

you can add other parameters :

subprocess.popen(['hostname', '-f', '-anotherparam', 'onemoreparam'], stdout=subprocess.pipe).communicate()[0] 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -