logo       

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

python.apple

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

"Russell E. Owen" <rowen@xxxxxxxxxxx> writes:

> 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.

Um. Python has an 'import lock' so only one thread can be importing a
module at the same time.

Do you have code like this:

def main():
....

main()

i.e. that does things as a result of being imported? You should stop
that :-)

Cheers,
mwh

--
well, take it from an old hand: the only reason it would be easier
to program in C is that you can't easily express complex problems
in C, so you don't. -- Erik Naggum, comp.lang.lisp

_______________________________________________
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