diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-05-12 22:25:16 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-05-12 22:25:16 (GMT) |
commit | 69a07fbd9b2c1e2d203532d4babbc6d874d389ee (patch) | |
tree | 822d06c6602339d309b30584ca0bfd05f5b56edc /Lib/plat-mac/terminalcommand.py | |
parent | a005b34f14fd4548c84886244b68d2c34e75edbd (diff) | |
download | cpython-69a07fbd9b2c1e2d203532d4babbc6d874d389ee.zip cpython-69a07fbd9b2c1e2d203532d4babbc6d874d389ee.tar.gz cpython-69a07fbd9b2c1e2d203532d4babbc6d874d389ee.tar.bz2 |
Remove the Mac modules
Diffstat (limited to 'Lib/plat-mac/terminalcommand.py')
-rw-r--r-- | Lib/plat-mac/terminalcommand.py | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/Lib/plat-mac/terminalcommand.py b/Lib/plat-mac/terminalcommand.py deleted file mode 100644 index 0e6e26d..0000000 --- a/Lib/plat-mac/terminalcommand.py +++ /dev/null @@ -1,47 +0,0 @@ -"""terminalcommand.py -- A minimal interface to Terminal.app. - -To run a shell command in a new Terminal.app window: - - import terminalcommand - terminalcommand.run("ls -l") - -No result is returned; it is purely meant as a quick way to run a script -with a decent input/output window. -""" - -# -# This module is a fairly straightforward translation of Jack Jansen's -# Mac/OSX/PythonLauncher/doscript.m. -# - -import time -import os -from Carbon import AE -from Carbon.AppleEvents import * - - -TERMINAL_SIG = "trmx" -START_TERMINAL = "/usr/bin/open /Applications/Utilities/Terminal.app" -SEND_MODE = kAENoReply # kAEWaitReply hangs when run from Terminal.app itself - - -def run(command): - """Run a shell command in a new Terminal.app window.""" - termAddress = AE.AECreateDesc(typeApplicationBundleID, "com.apple.Terminal") - theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress, - kAutoGenerateReturnID, kAnyTransactionID) - commandDesc = AE.AECreateDesc(typeChar, command) - theEvent.AEPutParamDesc(kAECommandClass, commandDesc) - - try: - theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) - except AE.Error as why: - if why.args[0] != -600: # Terminal.app not yet running - raise - os.system(START_TERMINAL) - time.sleep(1) - theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) - - -if __name__ == "__main__": - run("ls -l") |