logo       

Re: urllib and ftplib hang in bundle but not when run directly: msg#00073

python.apple

Subject: Re: urllib and ftplib hang in bundle but not when run directly

In article <rowen-C76C8E.09571605052004@xxxxxxxxxxxxx>,
"Russell E. Owen" <rowen@xxxxxxxxxxx> wrote:

>I am having trouble with some ftp code. On some platforms it works fine
>and on others it reliably hangs....(including MacOS X command-line
>it works, but a bundled app version of the identical code fails)

After some experimentation, I found the hanging was occurring in ftplib.
It delays importing re and compiling two regular expressions until they
are needed, and the thread hangs both on the import and (if I modify
ftplib to import re in advance) on the compilation. Modifying ftplib to
do both jobs in advance (when first imported) fixes the problem.

It seems strange to me that a thread could hang indefinitely trying to
perform these two tasks when the rest of the app seems to be running
fine. Perhaps the thread is simply being starved of cpu cycles, but then
it seems odd that the thread has enough cycles to print diagnostics and
do network communication.

Anyway, I can work around the problem by using ftplib directly instead
of using urllib, and importing my own patched ftplib. But I'm wondering
if anyone has any better suggestions.

-- Russell


_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/pythonmac-sig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise