title: Python. Send Uploaded File To Remote Server
body: <p>In My Flask App, i want to upload a file to a remote server.</p>
  
  <p>i tried this code but i get an error</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>this was just a test file. there's an image in the same directory as my test python file. the error said:</p>
  
  <blockquote>
    <p>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 <strong>init</strong>
        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] The system cannot find the file specified</p>
  </blockquote>