Thanks for the reply Bob. I've been digging around in the Python Documentation Macintosh and more specifically Carbon.File. (All seems to be a bit of a secret society :~) with scant docs that are not up to date and no content in __doc__s so it's a little hard going) What you noted doesn't seem to work verbatim for me, but noting the following from the Python site googling: ResolveAliasFile(file) Resolve an alias file. Returns a 3-tuple (fsspec, isfolder, aliased) where fsspec is the resulting FSSpec object, isfolder is true if fsspec points to a folder and aliased is true if the file was an alias in the first place (otherwise the FSSpec object for the file itself is returned). and following your lead I got the following where ppath is an Aqua alias to a folder so I need to check for an Aqua alias to a file: >>> FSResolveAliasFile(ppath, 1) (<Carbon.File.FSRef object at 0xe0a70>, 1, 1) >>> FSResolveAliasFile(ppath, 1)[0].as_pathname() '/Library/Documentation' with the FSRef though I get the following >>> def is_alias(ppath): ... return FSRef(ppath)[0] ... >>> ppath = '/Users/Chinook/Documents/Personal/Sys Documentation alias 1' >>> is_alias(ppath) Traceback (most recent call last): File "/Applications/WingIDE-Professional-2.0.3/WingIDE.app/Contents/MacOS/src/debug/server/_sandbox.py", line 1, in ? # Used internally for debug sandbox under external interpreter File "/Applications/WingIDE-Professional-2.0.3/WingIDE.app/Contents/MacOS/src/debug/server/_sandbox.py", line 2, in is_alias if __name__ == '__main__': TypeError: unsubscriptable object Or from the Terminal: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> from Carbon.File import FSResolveAliasFile, FSRef >>> FSRef('/Users/Chinook/Documents/Personal/Sys Documentation alias 1') <Carbon.File.FSRef object at 0x16cd8> >>> def is_alias(ppath): ... return FSRef(ppath)[0] ... >>> ppath = '/Users/Chinook/Documents/Personal/Sys Documentation alias 1' >>> is_alias(ppath) Traceback (most recent call last): File "<stdin>", line 1, in ? File "<stdin>", line 2, in is_alias TypeError: unsubscriptable object >>> Guess I'll have to do some more googling, but it (tentatively) looks like I'm getting back a file ref object as if .data is a default and I have to look at what other methods are available. Thanks again, Lee C On Jun 5, 2005, at 11:02 PM, Bob Ippolito wrote:
|
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig