2007/10/19, Adam Olsen <[EMAIL PROTECTED]>: > The solution then is, if your python file will ever be imported, you > must write a main function and do all the work there instead. Do not > write it in the style of a script (with significant work in the global > scope.)
I had this a as a good coding style, not so mandatory. I agree with you that the OP shouldn't be doing that, but note that the main problem arises here because it's completely unpredictable the import in strptime for an external user. Do you recommend to close the bug as "won't fix" saying something like... The deadlock happens because strptime has an import inside it, and recursive imports are not allowed in different threads. As a general rule and good coding style, don't run your code when the module is imported, but put it in a function like "main" in the second file, import it and call it from the first one. This will solve your problem. Note that this happens to you with strptime, but could happen with a lot of functions that do this internal import of something else. So, you'll never be sure. What do you think? Thank you! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com