私はいくつかのバックアップをタールこのスクリプトを書いた:それはpopenのコマンドに真=Pythonとtarコマンドシェル= Trueの
File "test.py", line 21, in <module>
subprocess.Popen(tar)
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
私はシェルを追加する場合:
date = str(now.year)+str(now.month)+str(now.day)
tar="tar -pczf "+date+"backup_lucas.tar.gz /home/lucas/backup/"
subprocess.Popen(tar)
しかし、私は取得作品:
しかし、時には安全ではないので、シェル= Trueは避けなければならないと聞きました(?)。
shell = Trueを使用せずにコマンドを正常に発行するにはどうすればよいですか?