简体   繁体   中英

Running a UNIX command via python script

I have to execute this following command

exec /dir6/dir5/dir4/openssl enc -d -aes-256-cbc -a -in /home/dir2/dir3/XXX.enc -pass pass:password

from my python Script. I have used

subprocess.call(["exec"," /dir6/dir5/dir4/openssl","enc","-d","-aes-256-cbc","-a","-in","/home/dir2/dir3/XXX.enc","-pass", "pass:password"])

but it doesn't work.

Can anyone help me on this. Thanks in advance.

you don't need "exec" here, and there is an unneeded space before /dir6 :

subprocess.call(['/dir6/dir5/dir4/openssl', 'enc', '-d', '-aes-256-cbc', '-a', '-in', '/home/dir2/dir3/XXX.enc' ,'-pass' , 'pass:password'])

I assumed that your command works, but I could not find the -pass option in the openssl manual.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM