Thank you both very much for your responses. This was very helpful - I now have working code.

Using the package pointed to by Bob Ippolito, I find I cannot use the import statement suggested by has  hengist, although it may work with the package that he points to. My code now looks like:

from LaunchServices.Launch import LSFindApplicationForInfo
from Carbon.CoreFoundation import kCFURLPOSIXPathStyle
import MacOS

creatorID = 'KONA'

   try:
     adobeHelpFSRef, adobeHelpURL = \
                 LSFindApplicationForInfo(creatorID, None, None)
      adobeHelpPath = \

adobeHelpURL.CFURLCopyFileSystemPath(kCFURLPOSIXPathStyle).toPython()
   except MacOS.Error :
      adobeHelpPath = None

adobeHelpPath is now a Unicode string, and needs to be encoded as 'utf-8' to work with some file operatons.




At 7:50 AM -0500 1/31/05, Bob Ippolito wrote:
On Jan 31, 2005, at 1:50, Read Roberts wrote:

Now that mcfs.py is deprecated, what is an alternative for the now unsupported FindApplication?

The LaunchServices package. Python 2.4 ships with it (Carbon.LaunchServices I think?) or you can use this package for 2.3 <http://mail.python.org/pipermail/pythonmac-sig/2004-November/012211.html> to get it.


Alternatively, you can use PyObjC 1.2 or later to just wrap the C function directly like this: <http://svn.red-bean.com/pyobjc/trunk/pyobjc/Examples/AppKit/PyObjCLauncher/LaunchServices.py>.

-bob

_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to