TypeError: cannot concatenate 'str' and 'list' objects
<p>I have a snippet of code which works:</p>

<pre><code>p = subprocess.Popen('psftp servername'.split(),stdin=subprocess.PIPE, tdout=subprocess.PIPE, shell=True)   
p.stdin.write('lcd P:\\ORACLE_UNIX\\Development\n')    
p.stdin.write('get //opt//jboss//current//server//default//conf//DMS.properties\n')    
p.stdin.write('bye\n')    
p.stdout.close()    
p.stdin.close()
</code></pre>

<p>But when I have a variable set (as I will refer to the server in other parts):</p>

<pre><code>devserv='servername'  
p = subprocess.Popen('psftp' +devserv.split(),stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
p.stdin.write('lcd P:\\ORACLE_UNIX\\Development\n')    
p.stdin.write('get //opt//jboss//current//server//default//conf//DMS.properties\n')    
p.stdin.write('bye\n')    
p.stdout.close()    
p.stdin.close()
</code></pre>

<p>...I always get <em>TypeError: cannot concatenate 'str' and 'list' objects</em>. Why?</p>
