Help with Macintosh files on NT

Greg Jorgensen gregj at pobox.com
Tue Dec 5 02:36:09 EST 2000


<geos at bigfoot.com> wrote in message news:908oj4$hm1$1 at nnrp1.deja.com...
> I'm getting a bit desperate.  I can't seem to find the answer
> anywhere.  In any case, this is the scenario.  We have an NT machine
> with Macintosh Services turned on.  There are Macintosh files saved on
> the machine with special characters which show up as a bold pipe (|)
> when browsing using explorer (see attached file), but ? when viewed in
> dos.  how can i actually identify those files in python?
>
> b=os.listdir('.')
> >>> print b
> ['Cloud Gallery', 'EC 12?94', 'Federal Clip Art', 'File 10?10?2000
> copy', 'ICON?', 'Network Trash
> Folder', 'TheVolumeSettingsFolder', '\306 A and E together', '\357 i
> with 2 dots', '\325 O with tilde', '\371 u with accent', '\373 u with a
> hat', '\260 degree', '\231 TradeMark', "? You're a star"]
> >>> for path in b:
> ... print os.stat(path)

It looks like the | or ? characters are actually forward or backward
slashes. Both of those characters are legal in Mac filenames, but \ is not
legal in Windows, and / is not legal on Unix. It also looks like some of the
filenames contain non-printable characters and characters in the high ASCII
range, which may be displayed as ? or some other character.

I don't know how you can get around this offhand... maybe fiddling with the
environ settings. It could be a shortcoming in whatever Windows system call
os.listdir is using.

--
Greg Jorgensen
Deschooling Society
Portland, Oregon, USA
gregj at pobox.com





More information about the Python-list mailing list