[Pythonmac-SIG] Re: urllib and ftplib hang in bundle but not when run directly

Russell E Owen rowen at u.washington.edu
Mon May 17 20:05:04 EDT 2004


At 11:39 PM +0200 2004-05-17, Jack Jansen wrote:
...(helpful info on debugging a multithreaded app with gdb deleted;
I had found the basic tutorials but was having trouble getting the
thread stuff working)

>>  Note that this same code also hangs under RedHat 9.2 linux with 
>>Python 2.3.3.
>
>Ah, then I misread your original post! This makes it a general 
>problem, not a mac-specific one...

Yes. It turns out that Michael Hudson was exactly right. The problem 
was contention for the import lock.

I originally wrote my app to be run as follows:
% python <tui_root>/TUI/Main.py
Unfortunately, I added a hack to simplify my bundlebuilder script: I 
added a file:
<tui_root>runtui.py
whose sole contents were (oops):
import TUI.Main

which is exactly what Michael warned me not to do (and I knew it was 
ugly at the time, but didn't realize it was actually dangerous).

Worse, I forgot to convert my command-line system to use that new 
file, even though I converted other users (because since it 
simplified setup--no need to set PYTHONPATH).

Thus I was running my app from the command line differently than 
everybody else. I'd forgotten all about the hack when I read 
Michael's message.

Anyway, fixing TUI/Main.py to be run via a function call fixed the problem.

Thank you very much for all your help. I'm very relieved it turned 
out to be something simple (despite such complex symptoms).

Regards,

-- Russell



More information about the Pythonmac-SIG mailing list