[Pythonmac-SIG] Spotlight Importing without .py

Nicholas Matsakis matsakis at mit.edu
Sun Jan 22 06:13:07 CET 2006

Henning Hraban Ramm wrote:

> In this case, 'file' may be right. But I wouldn't trust it if you've to 
> handle a lot of file types. ... Mostly I could trust in extensions 
> and/or Mac type/creator codes.

I certainly agree with this; applications that create files are in the 
best position to know how they should be typed (and thus handled by 
various other applications).  However, if no extentions or type codes are 
around, then I'd rather the system make a best effort rather throw up its 
hands in disgust.

This is especially true of the Finder, since it generally interacts 
directly with the user an can say something akin to "I'm not sure what 
kind of file this is, but it appears to be a JPEG, would you like to open 
it with your default app for JPEGs?" The spotlight metadata importer 
doesn't interact with the user and so I could see that a more conservative 
approach (insisting on type metadata) might be appropriate there.

This has clearly gone off topic, so I'll bring it back again.  I 
downloaded the MacPython distribution for Mac OS 9 in the hopes that I 
might gleen the type/creators codes associated with that distribution. 
There are no python sources that I can see there that don't have a .py 
extension, but all of them have a creator of "Pyth" and a type of "TEXT". 
This makes some sense, since you probably want double-clicking such a file 
to open it in a text editor. (.pyc files, incidentally, have a type of 

So, is it possible there is _no_ standard type code for python source?  If 
not, any thoughts on registering one?

Nick Matsakis

More information about the Pythonmac-SIG mailing list