Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28666

Re: os.stat() distorts filenames that end with period (nt.stat())

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 <john.ruckstuhl@gmail.com>
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 <mailman.341.1346980737.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=76.247.181.109; posting-account=iDie7AoAAAAFO32oTp1PonAhlnaPMExO
References <da480cba-c79a-44bc-bcfc-b192ce5aca69@googlegroups.com> <mailman.341.1346980737.27098.python-list@python.org>
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 <john.ruckstuhl@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org, d@davea.name, ruck <john.ruckstuhl@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.345.1346982861.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


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 "<pyshell#16>", line 1, in <module>
> 
> >         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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

os.stat() distorts filenames that end with period (nt.stat()) ruck <john.ruckstuhl@gmail.com> - 2012-09-06 17:55 -0700
  Re: os.stat() distorts filenames that end with period (nt.stat()) Dave Angel <d@davea.name> - 2012-09-06 21:18 -0400
    Re: os.stat() distorts filenames that end with period (nt.stat()) ruck <john.ruckstuhl@gmail.com> - 2012-09-06 18:54 -0700
    Re: os.stat() distorts filenames that end with period (nt.stat()) ruck <john.ruckstuhl@gmail.com> - 2012-09-06 18:54 -0700
  Re: os.stat() distorts filenames that end with period (nt.stat()) alex23 <wuwei23@gmail.com> - 2012-09-06 18:49 -0700
    Re: os.stat() distorts filenames that end with period (nt.stat()) ruck <john.ruckstuhl@gmail.com> - 2012-09-06 19:46 -0700
  Re: os.stat() distorts filenames that end with period (nt.stat()) Terry Reedy <tjreedy@udel.edu> - 2012-09-06 22:05 -0400
    Re: os.stat() distorts filenames that end with period (nt.stat()) ruck <john.ruckstuhl@gmail.com> - 2012-09-06 22:54 -0700
    Re: os.stat() distorts filenames that end with period (nt.stat()) ruck <john.ruckstuhl@gmail.com> - 2012-09-06 22:54 -0700
  Re: os.stat() distorts filenames that end with period (nt.stat()) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-07 02:32 +0000
  Re: os.stat() distorts filenames that end with period (nt.stat()) Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-06 21:12 -0600

csiph-web