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())

References <da480cba-c79a-44bc-bcfc-b192ce5aca69@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2012-09-06 21:12 -0600
Subject Re: os.stat() distorts filenames that end with period (nt.stat())
Newsgroups comp.lang.python
Message-ID <mailman.349.1346987553.27098.python-list@python.org> (permalink)

Show all headers | 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