[Pythonmac-SIG] Spotlight and Python

Bob Ippolito bob at redivi.com
Wed May 11 03:52:53 CEST 2005


On May 10, 2005, at 8:52 PM, Jonathan Wight wrote:

> I've made a first pass at it and have a Spotlight importer that calls
> a built-in Python function to import a file's metadata.
>
> I started to look at module inspect to find out how to extract
> information from a Python module but then realised that I'd need to
> import the file the importer is analysing. This would mean it will be
> executing arbitrary code inside that file. That's got to be a bad
> thing for security reasons.
>
> So instead I'm just going to have to use string processing to scan
> the file instead. Are there any modules out there for extracting
> information from Python script files?

You want to use the parser module.

-bob



More information about the Pythonmac-SIG mailing list