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:
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:
#!/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)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?