Hey Ken. :-) It hung for me.
Gary got a CommandError at count 57474 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 21, in first_timeout File "build/bdist.macosx-10.6-universal/egg/appscript/reference.py", line 504, in __call__ appscript.reference.CommandError: Command failed: OSERROR: -1712 MESSAGE: Apple event timed out. COMMAND: app(u'/Applications/iTunes.app').tracks[1].name.get() On Nov 18, 2009, at 2:54 PM, ken manheimer wrote: > def first_timeout(): > """Gratuitous itunes appscript reference cycle to elicit a timeout. > > It usually happens on some systems after just about 2**16 (= 2**2**2**2) > interactions, and sometimes substantially before that.""" > import appscript > import sys > itunes = appscript.app('itunes') > t = itunes.tracks[1] > count = 0 > class PassedLimit(Exception): pass > try: > while True: > count += 1 > if count % 1000 == 0: > sys.stderr.write("%i\n" % count) > if count > 65530: > sys.stderr.write("%i\n" % count) > elif count > 66000: > raise PassedLimit > x = t.name.get() > except appscript.reference.CommandError: > sys.stderr.write("got a CommandError at count %i\n" % count) > raise > except PassedLimit: > sys.stderr.write("exceeded threshold without triggering the > timeout\n") _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig