Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paramiko error using put

Hi I am using paramiko 1.7.6 "fanny" on microsoft windows xp v2002 service pack3 with python 2.4.2

I have the follwing script:

import paramiko

hostname='blah' 
port=22
username='blah'
password='blah'
fullpath='\\\\root\\path\\file.xls'
remotepath='/inbox/file.xls'

self.client= paramiko.SSHClient()
self.client.load_system_host_keys()
self.client.connect(hostname,port,username,password)
sftp = self.client.open_sftp()
sftp.put(fullpath,remotepath)

the error I get is:

sftp.put(fullpath,remotepath))

File "build\bdist.win32\egg\paramiko\sftp_client.py", line 577, in put
File "build\bdist.win32\egg\paramiko\sftp_client.py", line 337, in stat
File "build\bdist.win32\egg\paramiko\sftp_client.py", line 628, in _request
File "build\bdist.win32\egg\paramiko\sftp_client.py", line 675, in _read_response
File "build\bdist.win32\egg\paramiko\sftp_client.py", line 701, in _convert_status
IOError: [Errno 2] /inbox/file.xls is not a valid file path

but the path definitely exists (I can move into it using sftp.chdir('inbox')) I have also tried moving into the folder and using put but I get the exact same error (did take out inbox prefix)

Has anyone had this issue?

Cheers matt

like image 376
amc_552345 Avatar asked Aug 17 '26 01:08

amc_552345


1 Answers

IOError: [Errno 2] /inbox/file.xls is not a valid file path

This is your error, which means that /inbox isn't a valid path. You probably meant to use

remotepath='inbox/file.xls'

like image 87
JimB Avatar answered Aug 18 '26 16:08

JimB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!