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


Groups > comp.lang.python > #28659

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

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!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
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; 'exist,': 0.07; 'filename': 0.07; 'rename': 0.07; 'trailing': 0.07; 'python': 0.09; 'okay': 0.09; 'cc:addr:python-list': 0.10; '2.7': 0.13; 'ignore': 0.13; '2.7.2': 0.16; 'least.': 0.16; 'workaround?': 0.16; 'wrote:': 0.17; 'thanks,': 0.18; '>>>': 0.18; 'windows': 0.19; '"",': 0.22; '3.2': 0.22; 'recognize': 0.22; 'cc:2**0': 0.23; 'seems': 0.23; '(this': 0.24; 'cc:no real name:2**0': 0.24; 'linux': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; '(most': 0.27; "doesn't": 0.28; 'comments?': 0.29; 'subject:end': 0.29; 'file': 0.32; 'traceback': 0.33; 'pm,': 0.35; "won't": 0.35; 'there': 0.35; 'subject:with': 0.36; 'subject: (': 0.36; 'subject:: ': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'john': 0.60; 'here': 0.65; 'header :Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; '[error': 0.84; 'periods.': 0.84; 'period.': 0.95
Date Thu, 06 Sep 2012 21:18:28 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To ruck <john.ruckstuhl@gmail.com>
Subject Re: os.stat() distorts filenames that end with period (nt.stat())
References <da480cba-c79a-44bc-bcfc-b192ce5aca69@googlegroups.com>
In-Reply-To <da480cba-c79a-44bc-bcfc-b192ce5aca69@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:/ZwPh0Vxnn5qCXzJRr+oiG4qPPfW2+5fOYuQev6y3d9 LJFa2YXBlguhn5ImI7X0Fbd+Qmkj+K//f0E/jdN3DkooM0jbxJ w5bNCj0Ds8H+htv6JoUTqGEUPflZIseqN53SU/KwcLn+Xm+SCI +LvK9/mV8pahvvelytI3Qy8tcvV74CUSLoikEMNzAWHlWRuTzZ Ezp7BhuXmwQhn+mMbNqORsVrkDWCC+QDnw+JL8MjrUI1Ip67er jK/fw2PnsbG14ii2M7B8PyJXX6o74BQt0tSxjufg7BRoZMXHPa Mdelgy921EVv1O7KzGhYWdJwZck+twHsT1LZpMGq9H+N+OSww= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
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>
Newsgroups comp.lang.python
Message-ID <mailman.341.1346980737.27098.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346980737 news.xs4all.nl 6951 [2001:888:2000:d::a6]:58785
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28659

Show key headers only | View raw


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

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