|
Re: Re: urllib and ftplib hang in bundle but not when run directly: msg#00081python.apple
At 11:56 AM +0100 5/14/04, Michael Hudson wrote: "Russell E. Owen" <rowen@xxxxxxxxxxx> writes: It's an interesting idea. I didn't know about any import lock (just the global interpreter lock, which I doubt is relevant). I do have code like this: def _createMyConst(): ... _MyConst = _creatMyConst() that runs as a result of being imported. I thought that was normal python -- initialization can safely be done when the module is imported. I don't understand why that is considered dangerous or how it could run afoul of an importer lock. Also, my own code has fully loaded and finished initializing well before I try any ftp transfers and run into the problem. The hang occurs inside ftplib itself. I use it to fetch a file in a separate (background) thread. If "too much other stuff" is going on, that thread hangs. With ftplib as written, it hangs while executing "import re" (which is only done once the ftp starts). If I modify ftplib to import re right away at the beginning, then the thread hangs in ftplib compiling a regular expression. Modifying ftplib to pre-compile the two regular expressions it uses makes it stop hanging and my code starts working again. It seems strange to me that a thread could either work fine or 100% totally hang like that. It always works fine when run on MacOS X (when run as a command-line app). It always hangs forever when the identical code is run as a macOS X bundled app or when run on RedHat linux. When the same code is run as part of a smaller app, it runs fine on linux. -- Russell _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Broken link at python.org breaks packman: 00081, William Hesse |
|---|---|
| Next by Date: | Re: Broken link at python.org breaks packman: 00081, Bob Ippolito |
| Previous by Thread: | Re: Re: urllib and ftplib hang in bundle but not when run directlyi: 00081, Michael Hudson |
| Next by Thread: | Re: Re: urllib and ftplib hang in bundle but not when run directly: 00081, Michael Hudson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |