Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'root': 0.05; 'subject:file': 0.07; 'permissions': 0.09; 'subject:into': 0.09; 'worse': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'windows': 0.15; '-tkc': 0.16; 'denying': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'subject: \n ': 0.16; 'subject:download': 0.16; 'writable': 0.16; 'exception': 0.16; 'appropriate': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'import': 0.22; 'issue.': 0.22; 'cc:addr:python.org': 0.22; 'versions': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'script': 0.25; 'permission': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'newer': 0.30; "i'm": 0.30; "skip:' 10": 0.31; 'libraries': 0.31; 'file': 0.32; 'run': 0.32; 'subject:from': 0.34; 'problem': 0.35; 'no,': 0.35; 'charset:us- ascii': 0.36; 'received:10': 0.37; 'skip:o 20': 0.38; '(i.e.,': 0.38; 'expect': 0.39; 'subject:can': 0.39; 'users': 0.40; 'simple': 0.61; 'save': 0.62; 'box,': 0.64; 'directory:': 0.84; 'fl:': 0.84 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1418063444657:2244419418 X-MC-Ingress-Time: 1418063441131 Date: Mon, 8 Dec 2014 12:32:56 -0600 From: Tim Chase To: Luuk Subject: Re: why can't download file from linux server into local window disk c:? In-Reply-To: <5485E9DC.6000509@invalid.lan> References: <5486AF57.7070803@gmail.com> <5485E9DC.6000509@invalid.lan> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418068062 news.xs4all.nl 2913 [2001:888:2000:d::a6]:59322 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82141 On 2014-12-08 19:11, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: > >> with open(localpath, 'wb') as fl: > >> PermissionError: [Errno 13] Permission denied: 'c:' > > > > I remember gloomily (haven't used windows since ages) that newer > > Windows versions don't like users to write directly to C:. Have > > you tried to save the file to your Documents folder? > > > > Regards, > > Alba > > no, it's the ssh-server denying a log on from 'root' I'm going to go out on a limb and say that's pretty clearly not the issue. The exception states that the problem is one of permissions on the C: PermissionError: [Errno 13] Permission denied: 'c:' which ishish clearly identified as a "Windows doesn't let you do that any more" issue. Additionally, I don't know off the top of my if the Paramiko libraries expect a file-name, or if they expect a directory into which the file gets put based on the server-side name. The best solution is to do as ishish proposed: write the file to some other appropriate (i.e., writable) location. A simple fix might be import os # ... localpath = os.path.expanduser('~') or localpath = os.path.join( os.path.expanduser('~'), 'passwd.txt', ) A stop-gap solution might be to just run the program in a writable directory: c:\> cd %TEMP% c:\...\TEMP> python myprog.py A far worse solution would be to run the script as Administrator on the Win32 box, which will grant permission to write in the root of C: -tkc