Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6578051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:43:14+00:00 2026-05-25T15:43:14+00:00

Does somebody knows what this error means? Fatal Python error: PyEval_RestoreThread: NULL tstate In

  • 0

Does somebody knows what this error means?

Fatal Python error: PyEval_RestoreThread: NULL tstate

In my application when I destroy the main window this error is printed. I am using multiples threads to run differents jobs in the same time.

I really dont have any ideia what is this..

If someone ever lived the same problem please help me..

Below is a code to show how to reproduce this error. (I tried to make smallest code that I could)

#!/usr/bin/env python

import gtk
import threading
import sys

class Test(threading.Thread):
    """A subclass of threading.Thread, with a kill() method."""

    def __init__(self, *args, **keywords):
        threading.Thread.__init__(self, *args, **keywords)
        gtk.gdk.threads_init()
        self.killed = False

    def start(self):
        """Start the thread."""
        self.__run_backup = self.run
        self.run = self.__run # Force the Thread to install our trace.
        threading.Thread.start(self)

    def __run(self):
        """Hacked run function, which installs the trace."""
        sys.settrace(self.globaltrace)
        self.__run_backup()
        self.run = self.__run_backup

    def globaltrace(self, frame, why, arg):
        if why == 'call':
            return self.localtrace
        else:
            return None

    def localtrace(self, frame, why, arg):
        if self.killed:
            if why == 'line':
                raise SystemExit()
                return self.localtrace

    def kill(self):
        self.killed = True

class Window(gtk.Window):
    """Main window"""
    def __init__(self):
        """Create a main window and all your children"""
        super(Window, self).__init__()
        self.connect('destroy', gtk.main_quit)
        button = gtk.Button("Click and after, close window")
        button.connect("clicked", self.on_item_run)
        self.add(button)
        self.show_all()

    def on_item_run(self, widget):
        t = Test()
        t.start()

if __name__ == "__main__":
    window = Window()

    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave() 

Thanks a lot..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:43:15+00:00Added an answer on May 25, 2026 at 3:43 pm

    What version of gtk are you using? This link seems to indicate it’s a threading bug that was fixed in 2.0.1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does somebody knows if its possible to build a T-SQL query to obtain the
Does somebody knows where the file with the actual stored SharedPreferences is located?
Does somebody know how to recover a never-starting eclipse when the error org.eclipse.swt.SWTError: Item
Can somebody advise me what this code does and how can I convert it
Can somebody tell me what does this mean? I'm going trough Java book and
Does somebody know how to achieve this with XSL-FO transformation? The question details should
Does somebody know a Java library which serializes a Java object hierarchy into Java
does somebody tested - will authlogic works with oauth-plugin ( https://github.com/pelle/oauth-plugin ) or not?
Can somebody explain what ASPXAuth cookie does? My website uses forms auth and I
Does anybody have any experience with TFS no longer letting somebody queue a new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.