why can't download file from linux server into local window disk c:
MRAB
mrab at 1
Tue Dec 9 11:32:00 EST 2014
To: pengsir
On 2014-12-09 08:14, pengsir wrote:
>
>
> My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server
> into my local window disk c: .
>
> import paramiko
> host = "x.y.z.w"
> port = 22
> transport = paramiko.Transport((host, port))
> password = "mykey"
> username = "root"
> transport.connect(username = username, password = password)
> sftp = paramiko.SFTPClient.from_transport(transport)
> filepath = '/etc/passwd'
> localpath = 'c:'
> sftp.get(filepath, localpath)
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line
> 719, in get
>
> with open(localpath, 'wb') as fl:
> PermissionError: [Errno 13] Permission denied: 'c:'
>
It's trying to open the file 'c:', but that's not a file, it's a folder.
Try, say, 'c:/passwd' instead.
--- SoupGate-Win32 v1.05
* Origin: <SpaceSST.BBS.Fidonet<>NNTP.gateway. at .piz.noip.me> (1:249/999)
--- Synchronet 3.15b-Win32 NewsLink 1.92
SpaceSST BBS Usenet <> Fidonet Gateway
More information about the Python-list
mailing list