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


Groups > comp.lang.python > #82228

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

From "Nobody" <nobody@1:249/999.remove-cdt-this>
Subject Re: why can't download file from linux server into local window disk c:
Message-ID <54866F2E.1766.complang@piz.noip.com> (permalink)
Newsgroups comp.lang.python
References <54866F2E.1744.complang@piz.noip.com>
Date 2014-12-09 11:32 -0500
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


  To: pengsir
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).

--- SoupGate-Win32 v1.05
 * Origin: <SpaceSST.BBS.Fidonet<>NNTP.gateway.@.piz.noip.me> (1:249/999)
--- Synchronet 3.15b-Win32 NewsLink 1.92
SpaceSST BBS Usenet <> Fidonet Gateway

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" <pengsir@1:249/999.remove-cdt-this> - 2014-12-09 11:32 -0500
  Re: why can't download file from linux server into local window disk c: "Luuk" <luuk@1:249/999.remove-cdt-this> - 2014-12-09 11:32 -0500
  Re: why can't download file from linux server into local window disk c: "Thomas Rachel" <thomas.rachel@1:249/999.remove-cdt-this> - 2014-12-09 11:32 -0500
  Re: why can't download file from linux server into local window disk c: "Nobody" <nobody@1:249/999.remove-cdt-this> - 2014-12-09 11:32 -0500

csiph-web