2010-12-23 30 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。

如果我們將第一個更改爲本地路徑,將第二個更改爲遠程路徑,則 工作正常。

沒有問題與此。

相關問題