2010-12-23 31 views
2

嗨,我使用的paramiko在Microsoft Windows XP V2002服务PACK3 1.7.6 “芬妮” 与Python 2.4.2的paramiko错误

我有follwing脚本:

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) 

错误我得到的是:

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 

但路径肯定存在我 也曾尝试移动到文件夹,并用放(我可以用sftp.chdir(“收件箱”)进入它),但我得到完全相同的 错误(取出收件箱前缀)

有没有人有这个问题?

干杯 亚光

+1

您是否尝试过使用反斜杠:__remotepath ='\\ inbox \\ file.xls'__? – mouad 2010-12-23 12:22:19

回答

1

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

这是你的错误,这意味着/收件箱是不是一个有效的路径。你可能想用的

remotepath='inbox/file.xls'

1

我有同样的问题。

的签名指定sftp_client.py 高清放(自我,localPath来,remotepath,回调=无,确认= TRUE):

大多数论坛的回答提到的第一个参数为remotepath。

如果我们将第一个更改为本地路径,将第二个更改为远程路径,则 工作正常。

没有问题与此。

相关问题