Jan-05-2018, 04:29 PM
I am receiving a 'No such file or directory' error on a command that is working in bash shell.
Here is the code:
If I go through each line in the python interpreter and then check values,
os.getcwd() returns '/home/dvdsrv/stores'
and cmdZip returns '7z a -t7z Backup-01-04-18.7z /home/dvdsrv/stores/*'
And when I run that command from bash it works, but calling it from subprocess.Popen() gives me the error.
What am I missing here?
Here is the code:
1 2 3 4 5 6 7 8 9 |
#!/bin/python from datetime import date, timedelta import subprocess import os y = date.today() - timedelta( 1 ) strFile = 'Backup-' + y.strftime( '%m-%d-%y' ) + '.7z' cmdZip = '7z a ' + strFile + ' /home/dvdsrv/stores/*' os.chdir( '/home/dvdsrv/stores' ) suprocess.Popen(cmdZip) |
os.getcwd() returns '/home/dvdsrv/stores'
and cmdZip returns '7z a -t7z Backup-01-04-18.7z /home/dvdsrv/stores/*'
And when I run that command from bash it works, but calling it from subprocess.Popen() gives me the error.
What am I missing here?