Problems with scp script in Python

Joaquin Alzola Joaquin.Alzola at lebara.com
Mon Feb 13 07:26:41 EST 2017


>I have an SCP script that auto completes just fine from the terminal window in Pi.  When I use either subprocess or os to try and have it run under Python it does not do the file >transfer from Pi to my Ubuntu machine.  What am I doing wrong?  Here is the script:

>from subprocess import call
>cmd='scp -i id_rsa sample.txt jack at 192.168.1.103 /home/jack/pi_data'
>call (cmd.split ())

Do it manually first and check that it is working.
Then if you will not expect any output:

os.system(''scp -i id_rsa sample.txt jack at 192.168.1.103:/home/jack/pi_data')

I put a colon as well when I copy to a specific directory.
This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt.


More information about the Python-list mailing list