Path: csiph.com!usenet.pasdenom.info!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.alt.net!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail From: "Nobody" To: pengsir Subject: Re: why can't download file from linux server into local window disk c: Message-ID: <54866F2E.1766.complang@piz.noip.com> X-Comment-To: pengsir Newsgroups: comp.lang.python In-Reply-To: <54866F2E.1744.complang@piz.noip.com> References: <54866F2E.1744.complang@piz.noip.com> X-FTN-AREA: COMP.LANG.PYTHON X-FTN-PID: SoupGate-Win32 v1.05 X-FTN-MSGID: 28dc4a0a X-FTN-REPLY: d31fc52f Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: piz.noip.com [Synchronet 3.15b-Win32 NewsLink 1.92] X-Server: piz.noip.me Date: 9 Dec 2014 11:32:01 -0500 Lines: 26 Organization: Unlimited download news at news.astraweb.com NNTP-Posting-Host: 2266ad8f.news.astraweb.com X-Trace: DXC=LP`[=a9Aa>U7mQFj[j 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: NNTP.gateway.@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway