title: Python and Tar command shell=True
body: <p>I wrote this script to tar some backups : </p>
  
  <pre><code>date = str(now.year)+str(now.month)+str(now.day)
  tar="tar -pczf "+date+"backup_lucas.tar.gz /home/lucas/backup/"
  subprocess.Popen(tar)
  </code></pre>
  
  <p>But then I get : </p>
  
  <pre><code>  File "test.py", line 21, in &lt;module&gt;
      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
  </code></pre>
  
  <p>When I add add shell=True to the Popen command it works : </p>
  
  <pre><code>subprocess.Popen(tar,shell=True)
  </code></pre>
  
  <p>However I heard the shell=True is to be avoided as it is insecure sometimes (?). </p>
  
  <p>How can I successfully issue the command without using shell=True ? </p>