Python. Send Uploaded File To Remote Server -


in flask app, want upload file remote server.

i tried code error

import subprocess   import os  c_dir = os.path.dirname(os.path.abspath(__file__)) myfile = open(c_dir + '\\cape-kid.png')  p = subprocess.popen(["scp", myfile, destination]) sts = os.waitpid(p.pid, 0) 

this test file. there's image in same directory test python file. error said:

traceback (most recent call last): file "c:\users\waite-ryan-m\desktop\remote-saving\test-send.py", line 20, in p = subprocess.popen(["scp", c_dir + '\cape-kid.png', 'destination']) file "c:\users\waite-ryan-m\desktop\wpython\winpython-64bit-2.7.12.1zero\python-2.7.12.amd64\lib\subprocess.py", line 711, in init errread, errwrite) file "c:\users\waite-ryan-m\desktop\wpython\winpython-64bit-2.7.12.1zero\python-2.7.12.amd64\lib\subprocess.py", line 959, in _execute_child startupinfo) windowserror: [error 2] system cannot find file specified

with open() open file read or write on it. want concatinate string , use parameter scp. maybe file want copy doesn't exist - have tried printing path constructed , checking manually? , have defined destination anywhere? message mean, system cannot find scp.


Comments