• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /macosx-10.9.5/pyobjc-42/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/PyObjCLauncher/
1import os
2
3def doscript(cmd):
4    OSASCRIPT = '/usr/bin/osascript'
5    # not ideal, of course
6    scriptcmd = [OSASCRIPT,
7        '-e', 'tell application "Terminal"',
8        '-e', 'run',
9        '-e', 'do script "%s"' % cmd.replace('\\', '\\\\').replace('"', '\\"'),
10        '-e', 'end tell']
11    return os.spawnv(os.P_WAIT, scriptcmd[0], scriptcmd)
12