Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'say,': 0.05; 'subject:file': 0.07; 'username,': 0.07; 'password)': 0.09; 'subject:into': 0.09; 'folder.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'port))': 0.16; 'received:192.168.1.4': 0.16; 'subject: \n ': 0.16; 'subject:download': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'file,': 0.19; 'skip:p 40': 0.19; 'import': 0.22; 'header:User- Agent:1': 0.23; 'instead.': 0.24; 'permission': 0.26; 'header:In- Reply-To:1': 0.27; 'host': 0.29; "skip:' 10": 0.31; '"",': 0.31; 'username': 0.31; 'file': 0.32; 'open': 0.33; 'linux': 0.33; '(most': 0.33; 'subject:from': 0.34; 'but': 0.35; 'disk': 0.36; 'skip:" 50': 0.36; 'server': 0.38; 'window': 0.38; 'to:addr :python-list': 0.38; 'recent': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'fl:': 0.84; 'try,': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=ZuVjKrLG c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=xSRs65CQCjkA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=CMVrhfXZHMuN5SHrqDIA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett:2500 Date: Mon, 08 Dec 2014 18:31:35 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: why can't download file from linux server into local window disk c:? References: <5486AF57.7070803@gmail.com> In-Reply-To: <5486AF57.7070803@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418063502 news.xs4all.nl 2841 [2001:888:2000:d::a6]:35662 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82135 On 2014-12-09 08: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 "", line 1, in > 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:' > It's trying to open the file 'c:', but that's not a file, it's a folder. Try, say, 'c:/passwd' instead.