[Pythonmac-SIG] AppleEvents in MacPython 2.3?

Larry Meyn Larry.A.Meyn at nasa.gov
Tue Aug 12 23:57:32 EDT 2003


My thanks to Mark and Bob for their help.  I've thrown together the 
following crude function to generate OS 9 style path names under OS X 
for a scriptable application that needs them.


def makeOS9abspath(path):
	"""Returns an ":" delimited, OS 9 style absolute path.
	"""
	import Carbon.File, os.path
	
	abspath = os.path.abspath(path)
	rootdisk = Carbon.File.FSRef('/').FSGetCatalogInfo(0)[2].as_tuple()[2]
	abspath = rootdisk + ":".join(abspath.split('/')) #make ':' delimited

	if os.path.isdir(path):
		return abspath + ":"  #add trailing ':' for directories
	else:
		return abspath

Larry Meyn
Aerospace Operations Modeling Office

M/S 210-10                      Phone:  (650) 604-5038
NASA Ames Research Center       Fax:    (650) 604-0222
Moffett Field, CA 94035-1000    E-mail: Larry.A.Meyn at nasa.gov
                                 E-Fax:  (425) 944-5526 sent via e-mail

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 965 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20030812/ab544001/attachment.bin


More information about the Pythonmac-SIG mailing list