Need help with integrating perl script with main python script.
I have a perl script by name: GetHostByVmname.pl
./GetHostByVmname.pl –server 10.0.1.191 –username Administrator –password P@ssword1 –vmname RHTest
I need to call above script from my python main script. Tried below, but doesn’t work:
param = "--server 10.0.1.191 --username Administrator --password P@ssword1 --vmname RHTest"
pipe = subprocess.Popen(["perl", "./GetHostByVmname.pl", param ], stdout=subprocess.PIPE)
You can either provide a shell command
Popen("./GetHostByVmname.pl –server 10.0.1.191 ...", ...)
Or an array where the the first element is the program and the rest are args.
Popen(["./GetHostByVmname.pl", "–server", "10.0.1.191", ... ], ...)
Currently, you are doing the equivalent of the following shell command:
perl ./GetHostByVmname.pl '–server 10.0.1.191 ...'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With