title: Python subprocess error: rsync error: syntax or usage error (code 1) at main.c(1407) [client=3.0.6]
body: <p>I'm writing a Python automation script to upload files via rsync. Running this from Bash works</p>
  <pre><code>/usr/bin/rsync -av -e “/usr/bin/ssh -i $PATH_TO_SSH_IDENTITY_KEY” $SRC USER@HOSTNAME:/firstparam/secondparam
  </code></pre>
  <p>However, running from Python gives this error</p>
  <pre><code>rsync error: syntax or usage error (code 1) at main.c(1407) [client=3.0.6]
  </code></pre>
  <p>This is the code in question calling rsync</p>
  <pre><code>cmd = ['/usr/bin/rsync', '-av', '-e', config.ssh_identity, src, config.host + ':/rootpath' + firstparam + '/' + secondparam]
  p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
  (output, err) = p.communicate()
  </code></pre>
  <p>where</p>
  <pre><code>config.ssh_identity = ‘/usr/bin/ssh -i $PATH_TO_SSH_IDENTITY_KEY’
  config.host = ‘USER@HOSTNAME’
  </code></pre>
  <p>What could have caused the error?</p>