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


Groups > comp.lang.python > #82150

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

From Nobody <nobody@nowhere.invalid>
Newsgroups comp.lang.python
Subject Re: why can't download file from linux server into local window disk c:?
Date 2014-12-08 22:25 +0000
Organization A noiseless patient Spider
Message-ID <pan.2014.12.08.22.25.03.434000@nowhere.invalid> (permalink)
References <mailman.16725.1418055279.18130.python-list@python.org>

Show all headers | View raw


On Tue, 09 Dec 2014 00:14:15 -0800, pengsir wrote:

> localpath = 'c:'
> sftp.get(filepath, localpath)

>      with open(localpath, 'wb') as fl:
> PermissionError: [Errno 13] Permission denied: 'c:'

It's trying to open "c:", which is a drive, as if it was a file.

You have to specify the destination filename, not just the directory.

Also, you probably shouldn't be trying to write to the root directory of
the C drive. You should probably be using a directory beneath either
%USERPROFILE% or %ALLUSERSPROFILE%.

Writing to the root of the system drive tends to require Administrator
privileges. Even if the current user is an administrator, the process must
have elevated privilege (e.g. via "Run as Administrator" or an explicit
privilege-elevation request from within the code).

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

why can't download file from linux server into local window disk c:? pengsir <elearn2014@gmail.com> - 2014-12-09 00:14 -0800
  Re: why can't download file from linux server into local window disk c:? Luuk <luuk@invalid.lan> - 2014-12-08 17:37 +0100
  Re: why can't download file from linux server into local window disk c:? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-12-08 20:36 +0100
  Re: why can't download file from linux server into local window disk c:? Nobody <nobody@nowhere.invalid> - 2014-12-08 22:25 +0000

csiph-web