I'm trying to upload a simple file from my local host (Windows) to a remote machine (UNIX) using Python 3.3
Here's the code:
import os
import Crypto
import paramiko
import pysftp
localpath = "C:\\py.txt"
remotepath = "/tmp/py.txt"
s = pysftp.Connection(host='10.1.1.1', username='user', password='pass')
s.put(localpath, remotepath)
The error which returns is:
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
s.put(localpath, remotepath)
File "C:\Python33\lib\site-packages\pysftp.py", line 349, in put
confirm=confirm)
File "C:\Python33\lib\site-packages\paramiko-1.14.0- py3.3.egg\paramiko\sftp_client.py", line 585, in put
file_size = os.stat(localpath).st_size
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C://py.txt'
I've tried different prefix for localpath, like 'C:\py.txt' but I get the same results.
Thanks in advance