why can't download file from linux server into local window disk c:?
Tim Chase
python.list at tim.thechases.com
Mon Dec 8 13:32:56 EST 2014
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
More information about the Python-list
mailing list