[ python-Bugs-1523465 ] threading.Thread Traceback

SourceForge.net noreply at sourceforge.net
Sun Jul 16 22:47:44 CEST 2006


Bugs item #1523465, was opened at 2006-07-16 17:40
Message generated for change (Comment added) made by roee88
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1523465&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Threads
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: roee88 (roee88)
Assigned to: Nobody/Anonymous (nobody)
Summary: threading.Thread  Traceback

Initial Comment:
I'm using the following line in my application:
Thread(target = open_new(dest)).start()

dest is file path set by user.
Got this traceback with python 2.5:
File "C:\python25\lib\threading.py", line 460, in 
__boostrap
self.run()
File "C:\python25\threading.py, line 440, in run
self.__target(*self.__args, **self.kwargs)
TypeError: 'bool' object is not callable

Worked well with python 2.4 .
OS: windows XP 32 bit.
Searched for a similar bug report but couldn't find 
one, sorry if it already been reported.

----------------------------------------------------------------------

>Comment By: roee88 (roee88)
Date: 2006-07-16 20:47

Message:
Logged In: YES 
user_id=1111143

I'm really sorry, I got confused because of a change 
between 2.4 and 2.5 in the return value of open_new.
Python 2.4 always returns None so there is no exception.

After reading the docs I saw I need to use:
Thread(target = open_new, args = [dest]).start()
Sorry again. Have a nice day :)

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2006-07-16 20:04

Message:
Logged In: YES 
user_id=31435

Why do you imagine it makes sense to pass a boolean as the
target?  What do you think that should do?  As the message
said, a bool object is not callable, and, from the docs:

"""
`target` is the callable object to be invoked by the `run()`
method. Defaults to None, meaning nothing is called. 
"""

It doesn't make sense to pass True (or, e.g., an integer,
string, list, dict, or anything else that isn't callable).

Note that it's not true that Python 2.4 (or any other
version of Python) accepted a boolen here either; e.g.,

$ python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import threading
>>> threading.Thread(target=True).start()
>>> Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Python24\lib\threading.py", line 442, in __bootstrap
    self.run()
  File "C:\Python24\lib\threading.py", line 422, in run
    self.__target(*self.__args, **self.__kwargs)
TypeError: 'bool' object is not callable


----------------------------------------------------------------------

Comment By: roee88 (roee88)
Date: 2006-07-16 19:18

Message:
Logged In: YES 
user_id=1111143

open_new is imported from webbrowser and it returns a 
boolean (True in that case).

This shouldn't conflict with the Thread target.
Just as a note, except for the Traceback everything works 
well. The dest does open.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2006-07-16 19:01

Message:
Logged In: YES 
user_id=31435

What does `open_new` return?  What does

print type(open_new(dest))

display in a failing case?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1523465&group_id=5470


More information about the Python-bugs-list mailing list