urllib hanging in thread
Russell E. Owen
rowen at cesmail.net
Thu May 13 19:26:22 EDT 2004
In article <rowen-AB8751.13133104052004 at nntp1.u.washington.edu>,
"Russell E. Owen" <rowen at cesmail.net> wrote:
>I am having trouble with some ftp code. On some platforms it works fine
>and on others it reliably hangs....
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
More information about the Python-list
mailing list