Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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; 'charset:iso-8859-7': 0.04; 'syntax': 0.04; 'permission.': 0.07; 'rename': 0.07; '[0]': 0.09; "ain't": 0.09; 'arguments': 0.09; 'dst': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'assume': 0.14; 'argument.': 0.16; 'ater': 0.16; 'be:': 0.16; 'comma': 0.16; 'comma,': 0.16; 'docs.': 0.16; 'dst)': 0.16; 'entirely.': 0.16; 'exists,': 0.16; 'file;': 0.16; 'flavors': 0.16; 'oserror': 0.16; 'programmers.': 0.16; 'raised.': 0.16; 'renaming': 0.16; 'seperated.': 0.16; 'src': 0.16; 'surrogate': 0.16; 'tuple': 0.16; 'unicode,': 0.16; 'unix,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'file,': 0.19; 'successful,': 0.19; '>>>': 0.22; 'programming': 0.22; 'putting': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'either.': 0.24; 'exists': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'michael': 0.29; 'leave': 0.29; '(this': 0.29; 'am,': 0.29; 'unix': 0.29; 'message-id:@mail.gmail.com': 0.30; 'container': 0.31; 'directory,': 0.31; 'raised': 0.31; 'file': 0.32; 'fri,': 0.33; 'subject:from': 0.34; 'could': 0.34; 'subject: (': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'right?': 0.36; "didn't": 0.36; "i'll": 0.36; 'being': 0.38; 'implement': 0.38; 'even': 0.60; 'matter': 0.61; "you're": 0.61; 'back': 0.62; 'more': 0.64; 'different': 0.65; 'needing': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'business': 0.70; 'safe': 0.72; 'atomic': 0.84; 'silently': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=xIijSYgdLFk5EYRBEEyuUviqUfTBYXsyFOYWhgjPeLo=; b=AhZqJ1XdA5rtTfyTn8VLffO297MxoElKspKqq/GoR0mdV+ClfjQvQS0v0QrZjsjQuS IWWwiTPNhl4ExRi+kb7aHPKT8n8KuPnmddFAeCvP9QP1v4fOkzZLE9bxHsIc/pF0eJJs DfDDHUFck+mYmF1jc1SxWzU2YsH6bcRc/yEx1W44CtASTXcqf9dmNybyBwj95URTlLvi 4HGkoduMutpZrqnBbka6IsaOx2wrLrsaIMwkq266of4okkmGxWfwcUSIw7ea3sNapAWR AXBOv4qvAwFkaKZBMbe1iwuzlze6zqVGLS1IdFLPjAU5F2/+OvpqBbYpxc9nOf+KWi3L DoYA== X-Received: by 10.112.204.231 with SMTP id lb7mr521754lbc.4.1370595187644; Fri, 07 Jun 2013 01:53:07 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <51B19587.8030801@gmail.com> References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <51aed313$0$11118$c3e8da3@news.astraweb.com> <4c19b71d-4de5-41ad-b6ae-fb133a6c331e@googlegroups.com> <2be143c4-77c6-4c84-ba1c-46b02bd503ff@googlegroups.com> <1465c96b-c33e-4d5b-894e-b184c031a185@googlegroups.com> <808b7897-8ed4-4e0e-8976-4a22ae7f24cd@googlegroups.com> <332812d7-71b3-4bbb-a846-09827a6df65d@googlegroups.com> <152c78f5-b777-44e2-a83d-a23ecf2f84a3@googlegroups.com> <51b13693$0$29966$c3e8da3$5496439d@news.astraweb.com> <3c1e7a3f-5e41-4ab8-bced-755a9ad6327d@googlegroups.com> <9204ec80-a272-4733-aabe-1e319a0c7add@googlegroups.com> <5FFE659B-8271-4AF7-9116-96B763972F95@gmail.com> <51B19587.8030801@gmail.com> From: "R. Michael Weylandt" Date: Fri, 7 Jun 2013 09:52:47 +0100 Subject: Re: Changing filenames from Greeklish => Greek (subprocess complain) To: =?ISO-8859-7?B?zenq/Ovh7/Igyu/98eHy?= Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable Cc: python-list 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: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370595194 news.xs4all.nl 15903 [2001:888:2000:d::a6]:38347 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47319 On Fri, Jun 7, 2013 at 9:10 AM, =CD=E9=EA=FC=EB=E1=EF=F2 =CA=EF=FD=F1=E1=F2= wrote: > On 7/6/2013 10:42 =F0=EC, Michael Weylandt wrote: > >>> os.rename( filepath_bytes filepath.encode('utf-8') > >> Missing comma, which is, after all, just a matter of syntax so it can't >> matter, right? > > I doubted that os.rename arguments must be comma seperated. All function calls in Python require commas if you are putting in more than one argument. [0] > But ater reading the docs. > > s.rename(src, dst) > > Rename the file or directory src to dst. If dst is a directory, OSError w= ill > be raised. On Unix, if dst exists and is a file, it will be replaced > silently if the user has permission. The operation may fail on some Unix > flavors if src and dst are on different filesystems. If successful, the > renaming will be an atomic operation (this is a POSIX requirement). On > Windows, if dst already exists, OSError will be raised even if it is a fi= le; > there may be no way to implement an atomic rename when dst names an exist= ing > file. > > Availability: Unix, Windows. > > Indeed it has to be: > > os.rename( filepath_bytes, filepath.encode('utf-8') Parenthesis missing here as well. > > 'mv source target' didn't require commas so i though it was safe to assum= e > that os.rename did not either. > That's for shell programming -- different language entirely. The surrogate business is back to Unicode, which ain't my specialty so I'll leave that to more able programmers. MW [0] You could pass multiple arguments by way of a tuple or dictionary using */** but if you want arguments that aren't in the container being passed, you're back to needing commas.