Mailing List Archive

Fatal Python error: PyThreadState_Get: no current thread
I've seen questions related to this error in dejanews, but no
definitive answer. It seems that this error can indicate a variety of
misconfigurations. Here's my situation:

I have a program written a while ago under python 1.4 that I am trying
to run under python 1.5.1. This program uses Tkinter, and makes no
reference to Threads. On my Solaris 2.6 machine here I have

python1.4 - compiled without threads
python1.5.1 - compiled with threads
python1.5.2 - compiled with threads

After a lot of reduction, I ended up with the 10 or so lines shown
below. If I run it each of the installed versions and press the
displayed quit button, I see the following

| qad16:tools $ /opt/python/python1.4/sunos5/bin/python test.py
| qad16:tools $ /opt/python/python1.5.1/bin/python test.py
| Fatal Python error: PyThreadState_Get: no current thread
| Abort
| qad16:tools $ /opt/python/python1.5.2/bin/python test.py
| qad16:tools $

So... what's wrong with my 1.5.1 installation? Have I misconfigured
the thread stuff, or is a bug that has been fixed in 1.5.2? There is a
note in the Misc/NEWS of 1.5.2 that says that PyThreadState_Get has
been replaced by a macro that doesn't do error checking. Does this
mean that the problem is still lurking in my 1.5.2 installation?

Thanks for any pointers!

Tim

-------------------- test.py --------------------
import sys
from Tkinter import *

def cancel():
sys.exit(0)

def quitFromWM(event):
pass

mf = Frame()
mf.bind("<Destroy>", quitFromWM )
f = Frame(mf).pack(side=BOTTOM,fill=BOTH)
Button( f, text = 'Quit', command = cancel ).pack()
mf.mainloop()




--------------------------------------------------------------
Tim Docker timd@macquarie.com.au
Quantative Applications Division
Macquarie Bank
Fatal Python error: PyThreadState_Get: no current thread [ In reply to ]
I was just trouble shooting a problem like this. I was using python.exe and
a xxx.pyd. The xxx.pyd had debug turned on and should have been named
xxx_d.pyd. When I ran with python_d.exe the "no current thread" error
cleared up.

If your lucky the Windows and Unix ports have this in common.

--Darrell


Timothy Docker <timd@macquarie.com.au> wrote in message
news:m4izp3rc21l.fsf@macquarie.com.au...
>
>
> I've seen questions related to this error in dejanews, but no
> definitive answer. It seems that this error can indicate a variety of
> misconfigurations. Here's my situation:
>
> I have a program written a while ago under python 1.4 that I am trying
> to run under python 1.5.1. This program uses Tkinter, and makes no
> reference to Threads. On my Solaris 2.6 machine here I have
>
> python1.4 - compiled without threads
> python1.5.1 - compiled with threads
> python1.5.2 - compiled with threads
>
> After a lot of reduction, I ended up with the 10 or so lines shown
> below. If I run it each of the installed versions and press the
> displayed quit button, I see the following
>
> | qad16:tools $ /opt/python/python1.4/sunos5/bin/python test.py
> | qad16:tools $ /opt/python/python1.5.1/bin/python test.py
> | Fatal Python error: PyThreadState_Get: no current thread
> | Abort
> | qad16:tools $ /opt/python/python1.5.2/bin/python test.py
> | qad16:tools $
>
> So... what's wrong with my 1.5.1 installation? Have I misconfigured
> the thread stuff, or is a bug that has been fixed in 1.5.2? There is a
> note in the Misc/NEWS of 1.5.2 that says that PyThreadState_Get has
> been replaced by a macro that doesn't do error checking. Does this
> mean that the problem is still lurking in my 1.5.2 installation?
>
> Thanks for any pointers!
>
> Tim
>
> -------------------- test.py --------------------
> import sys
> from Tkinter import *
>
> def cancel():
> sys.exit(0)
>
> def quitFromWM(event):
> pass
>
> mf = Frame()
> mf.bind("<Destroy>", quitFromWM )
> f = Frame(mf).pack(side=BOTTOM,fill=BOTH)
> Button( f, text = 'Quit', command = cancel ).pack()
> mf.mainloop()
>
>
>
>
> --------------------------------------------------------------
> Tim Docker timd@macquarie.com.au
> Quantative Applications Division
> Macquarie Bank
Fatal Python error: PyThreadState_Get: no current thread [ In reply to ]
[posted and e-mailed to Timothy Docker]

On Thu, 29 Apr 1999 10:45:41 -0400, "Darrell" <news@dorb.com> wrote:

>I was just trouble shooting a problem like this. I was using python.exe and
>a xxx.pyd. The xxx.pyd had debug turned on and should have been named
>xxx_d.pyd. When I ran with python_d.exe the "no current thread" error
>cleared up.
>
>If your lucky the Windows and Unix ports have this in common.

Close enough. This error occurs when an extension module uses a
python library (libpython1.5.a, python15.lib, python15_d.lib, and so
on) that is not the one that the interpreter uses. To eliminate it,
scan your directories for old libraries and remove them. Then link
against The-One-True-Library that the interpreter links against. You
can also try a clean install.

>--Darrell
>
>
>Timothy Docker <timd@macquarie.com.au> wrote in message
>news:m4izp3rc21l.fsf@macquarie.com.au...
>>
>>
>> I've seen questions related to this error in dejanews, but no
>> definitive answer. It seems that this error can indicate a variety of
>> misconfigurations. Here's my situation:

[snip]
Fatal Python error: PyThreadState_Get: no current thread [ In reply to ]
> > I was just trouble shooting a problem like this. I was using python.exe and
> > a xxx.pyd. The xxx.pyd had debug turned on and should have been named
> > xxx_d.pyd. When I ran with python_d.exe the "no current thread" error
> > cleared up.
> >
> > If your lucky the Windows and Unix ports have this in common.
>
> Close enough. This error occurs when an extension module uses a
> python library (libpython1.5.a, python15.lib, python15_d.lib, and so
> on) that is not the one that the interpreter uses. To eliminate it,
> scan your directories for old libraries and remove them. Then link
> against The-One-True-Library that the interpreter links against. You
> can also try a clean install.


Sounds like a reasonable explanation, though I can't really see how
this could have happened in my situation. Can anyone confirm that this
can be the cause of the problem under unix (particularly solaris)? I
have a bad habit of switching off when I see filenames ending in .lib!

--------------------------------------------------------------
Tim Docker timd@macquarie.com.au
Quantative Applications Division
Macquarie Bank