[Tutor] Python suddenly finding ".DS_Store" files in folder

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Apr 8 16:50:57 EDT 2004

> > Actually, it _is_ Mac OS X running around inserting files.
> Ye Gods. How strange. They certainly don't tell you that in the
switcher ads,
> do they ...

Nope, nor do Microsoft tell you about all the crud they write to
the registry or about the "hidden" files they use in the C:\ root
directory. Every OS uses hidden or special files to do its job,
provided the ordinary user doesn't uncover the gory details thats

BTW You do realise that Mac OS X applications are actually
folders and not really the simple files that finder displays
don't you?! :-)

> > And if we want our programs to follow the same conventions, we'll
have to
> > filter out those filenames ourselves.  If you write a small helper
> > function that filters out os.listdir()'s output, that should do
the trick.
> Yeah, now I have an ugly hack that checks if the file is .DS_Store
and if so,
> skips it.

You could skip all files that begin with.
if name[0] == '.' and filter all hidden files.

> I think I might want to take another look at Yellow Dog Linux...

What makes you think it would be any different? listdir will still
show hidden files there too, its not the OS its the way the function
is defined to work.

Alan G.

More information about the Tutor mailing list