[PYTHONMAC-SIG] apps freeze unless they print!

Joseph J. Strout jstrout@ucsd.edu
Sun, 18 May 1997 14:07:01 -0700

I'm suddenly finding that Python locks up under the following conditions: I
have a program in a loop which is working very hard (or snoozing) for a
long time without printing anything to the console window (sample code
below); I switch to the Finder or any other app; then I switch back --
presto, it's frozen.  By "frozen" I mean that the window is not refreshed,
I can't move it, and I can't switch back to the Finder or any other app; I
have to hit command-period or kill the Python process.

Perhaps the Mac guts are only being updated whenever the console window is
updated.  But I don't really want to clutter up my nice log window with
useless garbage (and system.out.write('') doesn't work either, I tried
it!).  Is there any other way to trigger the Mac event-handling parts?

I'm using Python 1.4 PPC, on a PowerBase 180 running MacOS 7.5.5.  Sample code:

from time import sleep
while t < 9999:
	#print t	# if this line is included, it works
	t = t+1

Any suggestions will be greatly appreciated!

-- Joe

|    Joseph J. Strout           Department of Neuroscience, UCSD   |
|    jstrout@ucsd.edu           http://www-acs.ucsd.edu/~jstrout/  |

PYTHONMAC-SIG  - SIG on Python for the Apple Macintosh

send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org