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 920067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:38:55+00:00 2026-05-15T18:38:55+00:00

I am trying to learn how to use threads with python. this is the

  • 0

I am trying to learn how to use threads with python. this is the code I have been studying:

import time
from threading import Thread

def myfunc(i):
    print "sleeping 5 sec from thread %d" % i
    time.sleep(5)
    print "finished sleeping from thread %d" % i

for i in range(10):
    t = Thread(target=myfunc, args=(i,))
    t.start()

the program runs fine in command prompt but when I try to run it in idle I get errors like this:

Traceback (most recent call last):
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
    return self.func(*args)
  File "C:\Python24\lib\idlelib\ScriptBinding.py", line 165, in run_module_event
    interp.runcode(code)
  File "C:\Python24\lib\idlelib\PyShell.py", line 726, in runcode
    self.tkconsole.endexecuting()
  File "C:\Python24\lib\idlelib\PyShell.py", line 901, in endexecuting
    self.showprompt()
  File "C:\Python24\lib\idlelib\PyShell.py", line 1163, in showprompt
    self.resetoutput()
  File "C:\Python24\lib\idlelib\PyShell.py", line 1178, in resetoutput
    self.text.insert("end-1c", "\n")
  File "C:\Python24\lib\idlelib\Percolator.py", line 25, in insert
    self.top.insert(index, chars, tags)
  File "C:\Python24\lib\idlelib\PyShell.py", line 315, in insert
    UndoDelegator.insert(self, index, chars, tags)
  File "C:\Python24\lib\idlelib\UndoDelegator.py", line 81, in insert
    self.addcmd(InsertCommand(index, chars, tags))
  File "C:\Python24\lib\idlelib\UndoDelegator.py", line 116, in addcmd
    cmd.do(self.delegate)
  File "C:\Python24\lib\idlelib\UndoDelegator.py", line 216, in do
    if text.compare(self.index1, ">", "end-1c"):
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 2784, in compare
    return self.tk.getboolean(self.tk.call(
TclError: expected boolean value but got ""

Is python threading just not stable or am I doing something grossly wrong? The example came from : http://www.saltycrane.com/blog/2008/09/simplistic-python-thread-example/

  • 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-15T18:38:55+00:00Added an answer on May 15, 2026 at 6:38 pm

    It sounds like a bug in IDLE, not a problem with Python. The error is coming from Tkinter, which is a Python GUI toolkit, and which IDLE probably uses. I would report it to whoever maintains IDLE.

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

Sidebar

Related Questions

I have been trying to learn to use github, it has been fine until
I have been trying to learn to use Ogre3D and have gotten to the
I am trying to learn how to use the C++ Boost.Thread library. I have
I'm trying to learn how to use threading in a python program. I'm using
I'm trying to learn how to use the force.layout features in D3.js and have
I am trying to learn and use html5 and have a basic layout but
I'm trying to learn to use Map with Jaxb. I did this: @XmlElementWrapper(name =
I am trying to learn how to use Cascadding Style Sheets. I have a
I'm trying to use JPA's Context Injection. Currently my code fails to have the
I'm trying to learn how to use OpenMP by parallelizing a monte carlo code

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.