def getappterminology(fullname, verbose=None):
 if (not MacOS.WMAvailable()):
  raise RuntimeError, 'Cannot send AppleEvents, no access to window manager'
 import Carbon.Evt
 Carbon.Evt.WaitNextEvent(0, 0)
 if os.path.isdir(fullname):
  pkginfo = os.path.join(fullname, 'Contents', 'PkgInfo')
  if (not os.path.exists(pkginfo)):
   raise RuntimeError, 'No PkgInfo file found'
  tp_cr = open(pkginfo, 'rb').read()
  cr = tp_cr[4:8]
 else:
  (cr, tp) = MacOS.GetCreatorAndType(fullname)
 talker = aetools.TalkTo(cr)
 try:
  talker._start()
 except (MacOS.Error, aetools.Error) as arg:
  if verbose:
   print >>verbose, 'Warning: start() failed, continuing anyway:', arg
 reply = talker.send('ascr', 'gdte')
 return (reply[1]['----'], cr)

def getappterminology ( fullname , verbose = None ) : if ( not MacOS . WMAvailable ( ) ) : raise RuntimeError , 'Cannot send AppleEvents, no access to window manager' import Carbon . Evt Carbon . Evt . WaitNextEvent ( 0 , 0 ) if os . path . isdir ( fullname ) : pkginfo = os . path . join ( fullname , 'Contents' , 'PkgInfo' ) if ( not os . path . exists ( pkginfo ) ) : raise RuntimeError , 'No PkgInfo file found' tp_cr = open ( pkginfo , 'rb' ) . read ( ) cr = tp_cr [ 4 : 8 ] else : ( cr , tp ) = MacOS . GetCreatorAndType ( fullname ) talker = aetools . TalkTo ( cr ) try : talker . _start ( ) except ( MacOS . Error , aetools . Error ) as arg : if verbose : print >> verbose , 'Warning: start() failed, continuing anyway:' , arg reply = talker . send ( 'ascr' , 'gdte' ) return ( reply [ 1 ] [ '----' ] , cr )
get application terminology by sending an appleevent .