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


Groups > comp.lang.python > #28674

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

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'exist,': 0.07; 'filename': 0.07; 'trailing': 0.07; 'python': 0.09; 'sep': 0.09; 'ignore': 0.13; '2.7.2': 0.16; 'extensions,': 0.16; 'received:mail- wi0-f178.google.com': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'thu,': 0.17; 'windows': 0.19; 'file.': 0.20; 'recognize': 0.22; '(this': 0.24; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'received:209.85.212': 0.28; 'subject:end': 0.29; 'file': 0.32; 'skip:8 10': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'subject:with': 0.36; 'subject: (': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'free': 0.61; 'world': 0.63; 'due': 0.66; 'serial': 0.66; 'periods.': 0.84; 'to:name:python': 0.84; 'period.': 0.95
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 :content-type; bh=H5vp+M7WAiIG75d0/kSLwctqy3gv5r/C1qkH2rDNnW8=; b=0SLkyx7ICxsjUHlz8WmCX5SdId9/bKVoJpFJ8Dp3GbJ1fJ9YvEjuFZeSwx0m3+ff49 zCrKhpnvV41l93PU0bGjIzaLpLo4JOFBcsmVsqzR1REsTMQr8aS1Z0n8Y9P2x3IRrSPf 8Smn1M7FHQ8M61znKoZREtnQAUlAN+gmQFNdKPNdV/cVOQANizXzWjNw2YpxR2V1uB0T DcvzcOPc2sItTByJRQlBGOTQfAXOSRQ9JkVl+0JHPl5ChpLht1JrrOlvi2xlFFqoEY0S hyW1ZSqoT0Hd4HEdh4zywx9+2EnVcuu8IpyTjX8dJw8XJVAT19oyTLnY5AJcUjsbr2ZM NMOg==
MIME-Version 1.0
In-Reply-To <da480cba-c79a-44bc-bcfc-b192ce5aca69@googlegroups.com>
References <da480cba-c79a-44bc-bcfc-b192ce5aca69@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 6 Sep 2012 21:12:01 -0600
Subject Re: os.stat() distorts filenames that end with period (nt.stat())
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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>
Newsgroups comp.lang.python
Message-ID <mailman.349.1346987553.27098.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346987553 news.xs4all.nl 6923 [2001:888:2000:d::a6]:57648
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28674

Show key headers only | View raw


On Thu, Sep 6, 2012 at 6:55 PM, ruck <john.ruckstuhl@gmail.com> 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.

Due to the weirdness of Windows filename extensions, these names refer
to the same file.

C:\Users\Ian>echo hello > goo

C:\Users\Ian>type goo
hello

C:\Users\Ian>type goo.
hello

C:\Users\Ian>type goo..
hello

C:\Users\Ian>type goo...
hello

C:\Users\Ian>echo world > goo...

C:\Users\Ian>dir goo*
 Volume in drive C is OS
 Volume Serial Number is 9881-66F0

 Directory of C:\Users\Ian

09/06/2012  09:10 PM                 8 goo
               1 File(s)              8 bytes
               0 Dir(s)   8,884,142,080 bytes free

C:\Users\Ian>type goo
world

Back to comp.lang.python | Previous | NextPrevious 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