[issue1255] Strange Python hangup

2007-10-26 Thread Jiri Krivanek

Jiri Krivanek added the comment:

In the mena time, by intuition, I have resolved my troube exactly the
way you recommend.

Thanks to you, currently I also know what is he core of the problem.

So the issue can be closed...

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1255
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1255] Strange Python hangup

2007-10-25 Thread Facundo Batista

Facundo Batista added the comment:

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, *a lot*, of functions that do this internal import of something
else. So, you'll never be sure.

You can follow the python-dev thread titled Deadlock by a second import
in a thread for more info.

--
nosy: +facundobatista
resolution:  - wont fix
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1255
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1255] Strange Python hangup

2007-10-10 Thread Tim Golden

Tim Golden added the comment:

Do you realise that the code at the bottom of bb.py is executed when you
import it from aa.py? In other words, when you run aa.py, the whole of
your significant code is running within an import statement. I don't
know if it's the cause of the problem (although I remember past
strictures on the messiness of threads and imports) but I doubt if it's
a fantastic design choice.

--
nosy: +tim.golden

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1255
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1255] Strange Python hangup

2007-10-10 Thread Jiri Krivanek

Jiri Krivanek added the comment:

The reason for it is pragmatic: The whole of my application is published
as .pyc files. Except of the only one which must stay .py - that one
which has to be executable (+x) on Linux and thus it starts with the line:
# !/usr/bin/python
and then it should only contain:
import something
and something is .pyc.

So I did a simple change into my application. I start it via a very
brief script whic only contains:
# !/usr/bin/python
import something

Wow! It stopped working at all!

After 4 hours of isolating of the problem I developped an elementary
code which demonstrates my problem (attached at the bug report).

I expect that the import statement does not return the control until the
code being executed by it finishes, does'n it?

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1255
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1255] Strange Python hangup

2007-10-10 Thread Jiri Krivanek

Jiri Krivanek added the comment:

One more hint: There is the coincidence of three facts:
1. It uses the thread (if I remove the thread then it works fine).
2. It is double imported (if I remove the outer import then it works
fine).
3. There is the strptime() function being used (if I remove this
function then it works fine).

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1255
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com