summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-03-28 23:42:37 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-03-28 23:42:37 (GMT)
commitd6ab153e5a715e409010e62d3214f848aa7339ed (patch)
treee40b5f973ab863dbdf5a9bf56c261abd6c90c33a /Lib/plat-mac
parentd4885f87fa203587b4f5cfd5961f7acbbe36c3c0 (diff)
downloadcpython-d6ab153e5a715e409010e62d3214f848aa7339ed.zip
cpython-d6ab153e5a715e409010e62d3214f848aa7339ed.tar.gz
cpython-d6ab153e5a715e409010e62d3214f848aa7339ed.tar.bz2
On OSX the finder will return from an open() event before the application
has actually entered its event loop. As a stopgap, allow for a 10 second grace period.
Diffstat (limited to 'Lib/plat-mac')
-rw-r--r--Lib/plat-mac/aetools.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/plat-mac/aetools.py b/Lib/plat-mac/aetools.py
index 8ac293d..0639541 100644
--- a/Lib/plat-mac/aetools.py
+++ b/Lib/plat-mac/aetools.py
@@ -26,12 +26,16 @@ from Carbon import AE
from Carbon import AppleEvents
import MacOS
import sys
+import time
from aetypes import *
from aepack import packkey, pack, unpack, coerce, AEDescType
Error = 'aetools.Error'
+# Amount of time to wait for program to be launched
+LAUNCH_MAX_WAIT_TIME=10
+
# Special code to unpack an AppleEvent (which is *not* a disguised record!)
# Note by Jack: No??!? If I read the docs correctly it *is*....
@@ -174,6 +178,14 @@ class TalkTo:
self.send('ascr', 'noop')
except AE.Error:
_launch(self.target_signature)
+ for i in range(LAUNCH_MAX_WAIT_TIME):
+ try:
+ self.send('ascr', 'noop')
+ except AE.Error:
+ pass
+ else:
+ break
+ time.sleep(1)
def start(self):
"""Deprecated, used _start()"""