Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82135 > unrolled thread

Re: why can't download file from linux server into local window disk c:?

Started byMRAB <python@mrabarnett.plus.com>
First post2014-12-08 18:31 +0000
Last post2014-12-08 18:31 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: why can't download file from linux server into local window disk c:? MRAB <python@mrabarnett.plus.com> - 2014-12-08 18:31 +0000

#82135 — Re: why can't download file from linux server into local window disk c:?

FromMRAB <python@mrabarnett.plus.com>
Date2014-12-08 18:31 +0000
SubjectRe: why can't download file from linux server into local window disk c:?
Message-ID<mailman.16729.1418063502.18130.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web