Abhishake Gupta
Abhishake Gupta

Reputation: 3170

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.

Upvotes: 0

Views: 200

Answers (1)

Jean Coiron
Jean Coiron

Reputation: 632

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.

Upvotes: 1

Related Questions