Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82206 > unrolled thread
| Started by | "pengsir" <pengsir@1:249/999.remove-cdt-this> |
|---|---|
| First post | 2014-12-09 11:32 -0500 |
| Last post | 2014-12-09 11:32 -0500 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
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
| From | "pengsir" <pengsir@1:249/999.remove-cdt-this> |
|---|---|
| Date | 2014-12-09 11:32 -0500 |
| Subject | why can't download file from linux server into local window disk c:? |
| Message-ID | <54866F2E.1744.complang@piz.noip.com> |
My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server
into my local window disk c: .
import paramiko
host = "x.y.z.w"
port = 22
transport = paramiko.Transport((host, port))
password = "mykey"
username = "root"
transport.connect(username = username, password = password)
sftp = paramiko.SFTPClient.from_transport(transport)
filepath = '/etc/passwd'
localpath = 'c:'
sftp.get(filepath, localpath)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line
719, in get
with open(localpath, 'wb') as fl:
PermissionError: [Errno 13] Permission denied: 'c:'
--- 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
[toc] | [next] | [standalone]
| From | "Luuk" <luuk@1:249/999.remove-cdt-this> |
|---|---|
| Date | 2014-12-09 11:32 -0500 |
| Subject | Re: why can't download file from linux server into local window disk c: |
| Message-ID | <54866F2E.1745.complang@piz.noip.com> |
| In reply to | #82206 |
To: pengsir On 9-12-2014 09:14, pengsir wrote: > > > My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server > into my local window disk c: . > > import paramiko > host = "x.y.z.w" > port = 22 > transport = paramiko.Transport((host, port)) > password = "mykey" > username = "root" > transport.connect(username = username, password = password) > sftp = paramiko.SFTPClient.from_transport(transport) > filepath = '/etc/passwd' > localpath = 'c:' > sftp.get(filepath, localpath) > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line > 719, in get > > with open(localpath, 'wb') as fl: > PermissionError: [Errno 13] Permission denied: 'c:' You, 'root', does not have enoug permission to do it.... C:\temp>\util\Putty\pscp root@opensuse:/etc/passwd . Using keyboard-interactive authentication. Password: Access denied --- 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
[toc] | [prev] | [next] | [standalone]
| From | "Thomas Rachel" <thomas.rachel@1:249/999.remove-cdt-this> |
|---|---|
| Date | 2014-12-09 11:32 -0500 |
| Subject | Re: why can't download file from linux server into local window disk c: |
| Message-ID | <54866F2E.1755.complang@piz.noip.com> |
| In reply to | #82206 |
Am 09.12.2014 09:14 schrieb pengsir: > My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server > into my local window disk c: . > localpath = 'c:' [...] > with open(localpath, 'wb') as fl: > PermissionError: [Errno 13] Permission denied: 'c:' That's completely clear: you are not allowed to create a file named 'c:'. You should replace it with a full path name, such as localpath = 'c:\\passwd' or such. Thomas --- 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
[toc] | [prev] | [next] | [standalone]
| From | "Nobody" <nobody@1:249/999.remove-cdt-this> |
|---|---|
| Date | 2014-12-09 11:32 -0500 |
| Subject | Re: why can't download file from linux server into local window disk c: |
| Message-ID | <54866F2E.1766.complang@piz.noip.com> |
| In reply to | #82206 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web