Issue1523465
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2006-07-16 17:40 by roee88, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (6) | |||
---|---|---|---|
msg29184 - (view) | Author: roee88 (roee88) | Date: 2006-07-16 17:40 | |
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. |
|||
msg29185 - (view) | Author: Tim Peters (tim.peters) * | Date: 2006-07-16 19:01 | |
Logged In: YES user_id=31435 What does `open_new` return? What does print type(open_new(dest)) display in a failing case? |
|||
msg29186 - (view) | Author: roee88 (roee88) | Date: 2006-07-16 19:18 | |
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. |
|||
msg29187 - (view) | Author: Tim Peters (tim.peters) * | Date: 2006-07-16 20:04 | |
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 |
|||
msg29188 - (view) | Author: roee88 (roee88) | Date: 2006-07-16 20:47 | |
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 :) |
|||
msg29189 - (view) | Author: Tim Peters (tim.peters) * | Date: 2006-07-16 22:20 | |
Logged In: YES user_id=31435 That's OK -- I'm glad you're unstuck now! Closing as Not-a-Bug. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:18 | admin | set | github: 43680 |
2006-07-16 17:40:37 | roee88 | create |