I have a snippet of code which works:
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()
But when I have a variable set (as I will refer to the server in other parts):
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()
...I always get TypeError: cannot concatenate 'str' and 'list' objects. Why?