Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.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; 'win32': 0.03; 'output': 0.04; 'exist,': 0.07; 'filename': 0.07; 'rename': 0.07; 'trailing': 0.07; 'python': 0.09; 'agree,': 0.09; 'okay': 0.09; 'specific.': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; '2.7': 0.13; 'ignore': 0.13; 'file,': 0.15; '2.7.2': 0.16; 'least.': 0.16; 'workaround?': 0.16; 'wrote:': 0.17; 'thanks,': 0.18; '>>>': 0.18; 'windows': 0.19; 'file.': 0.20; 'trying': 0.21; '"",': 0.22; '3.2': 0.22; 'recognize': 0.22; 'seems': 0.23; '(this': 0.24; 'linux': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'creating': 0.26; '(most': 0.27; 'cc:addr:gmail.com': 0.27; 'cc:2**2': 0.27; "doesn't": 0.28; 'comments?': 0.29; 'subject:end': 0.29; 'reporting': 0.29; 'thursday,': 0.30; 'expect': 0.31; 'file': 0.32; 'traceback': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'there': 0.35; 'cc:no real name:2**1': 0.36; 'subject:with': 0.36; 'test': 0.36; 'subject: (': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'john': 0.60; 'here': 0.65; 'hoping': 0.72; '[error': 0.84; 'periods.': 0.84; 'angel': 0.93; 'period.': 0.95 Newsgroups: comp.lang.python Date: Thu, 6 Sep 2012 18:54:19 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.247.181.109; posting-account=iDie7AoAAAAFO32oTp1PonAhlnaPMExO References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 76.247.181.109 MIME-Version: 1.0 Subject: Re: os.stat() distorts filenames that end with period (nt.stat()) From: ruck To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org, d@davea.name, ruck 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: , Message-ID: Lines: 84 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346982862 news.xs4all.nl 6853 [2001:888:2000:d::a6]:54612 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28666 On Thursday, September 6, 2012 6:19:11 PM UTC-7, Dave Angel wrote: > On 09/06/2012 08:55 PM, ruck wrote: > > > (This with Python 2.7.2 on Windows 7) > > > > > > os.stat() won't recognize a filename ending in period. > > > It will ignore trailing periods. > > > If you ask it about file 'goo...' it will report on file 'goo' > > > And if 'goo' doesn't exist, os.stat will complain. > > > > > > create file goo, then > > > > > > >>> os.stat('goo') > > > nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0L, st_atime=1346978160L, st_mtime=1346978160L, st_ctime=1346978160L) > > > >>> os.stat('goo...') > > > nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0L, st_atime=1346978160L, st_mtime=1346978160L, st_ctime=1346978160L) > > > > > > rename goo to "goo...", then, > > > > > > >>> os.stat('goo...') > > > > > > Traceback (most recent call last): > > > File "", line 1, in > > > os.stat('goo...') > > > WindowsError: [Error 2] The system cannot find the file specified: 'goo...' > > > > > > Puzzling, to me at least. > > > Any comments? > > > This with Python 2.7.2 on Windows 7. > > > Is there a workaround? > > > Thanks, > > > John > > > > FWIW, it seems to work okay here in Linux 11.04, both Python 2.7 and 3.2 > > > > > > -- > > > > DaveA Thanks, I agree, I expect this is Windows 7 or win32 specific. Also, in creating a test case to demonstrate, I may have clouded my intent. I want to walk() a dir, reporting the output of os.stat() for files below the dir. One of the existing files happens to be named like "goo..." And os.stat('goo...') fails to see the file. I am not trying to rename the file, just hoping to stat an existing file. John