Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'encoding': 0.05; 'expressions': 0.07; 'rename': 0.07; 'utf-8': 0.07; 'assigning': 0.09; 'filename': 0.09; ':-(': 0.16; 'brackets': 0.16; 'filenames.': 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; 'new_path': 0.16; 'spurious': 0.16; 'variables,': 0.16; ':-)': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'basically': 0.19; 'meant': 0.20; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; "i'm": 0.30; 'code': 0.31; 'writes:': 0.31; 'probably': 0.32; 'skip:b 30': 0.33; 'subject:from': 0.34; 'subject: (': 0.35; 'there': 0.35; "he's": 0.36; 'two': 0.37; 'needed': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'changed': 0.39; 'skip:u 10': 0.60; 'most': 0.60; 'more': 0.64; 'afraid': 0.65; 'here': 0.66; 'close': 0.67; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; '8bit%:100': 0.72; 'greek': 0.84; 'reply- to:addr:python.org': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=KrN0hwmN c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=oyR3mlnJdzkA:10 a=AdgiQdVXbpoA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=uw23S90zXSUA:10 a=pGLkceISAAAA:8 a=wQtN8ncgUeXVFv2NoXEA:9 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 X-AUTH: mrabarnett:2500 Date: Thu, 06 Jun 2013 22:57:42 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <06a19483-65df-4fcd-9430-b45a01c9dbab@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> <87bo7j6j8m.fsf@nautilus.nautilus> In-Reply-To: <87bo7j6j8m.fsf@nautilus.nautilus> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370555834 news.xs4all.nl 15989 [2001:888:2000:d::a6]:46332 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47285 On 06/06/2013 22:07, Lele Gaifax wrote: > Νικόλαος Κούρας writes: > >> Tahnks here is what i have up until now with many corrections. > > I'm afraid many more are needed :-) > >> ... >> # rename filename form greek bytestreams --> utf-8 bytestreams >> old_path = b'/home/nikos/public_html/data/apps/' + b'filename') >> new_path = b'/home/nikos/public_html/data/apps/' + b'new_filename') >> os.rename( old_path, new_path ) > > a) there are two syntax errors, you have spurious close brackets there > b) you are basically assigning *constant* expressions to both variables, > most probably not what you meant > Yet again, he's changed things unnecessarily, and the code was meant only as a one-time fix to correct the encoding of some filenames. :-(