[pywin32-bugs] [ pywin32-Bugs-1296632 ] TypeError: 'unicode' object is not callable
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2005-10-23 11:26:49
|
Bugs item #1296632, was opened at 2005-09-21 03:34 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1296632&group_id=78018 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: com Group: None >Status: Closed >Resolution: Wont Fix Priority: 5 Submitted By: Oleg Noga (oleg_noga) Assigned to: Nobody/Anonymous (nobody) Summary: TypeError: 'unicode' object is not callable Initial Comment: python 2.3.5 pythonwin 204 using dynamic binding Have TypeError: 'unicode' object is not callable while calling COM object function. Because CDispatch.__getattr__ returns empty unicode string instead of callable. I made some dirty fix, please, see attach, there is some comments inside It is win32com\client\dynamic.py Pity I can't supply COM object to reproduce because it is proprietary. ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2005-10-23 21:26 Message: Logged In: YES user_id=14198 The problem here is that Python tries to check if the attribute name is a method or property by requesting a property and handling the error that results. Even though Python asks specifically for a property (INVOKE_PROPERTYGET), the object is treating it as a function call and returning a string. pythoncom therefore assumes it is a simple property. VB does it correctly as its syntax prevents using functions as objects (eg, you can't assign an object method to a variable). There are 2 choices: * Change the object to honour the invoke flags correctly. * Call obj._FlagAsMethod("Method1", "method2", ...) And you will then be able to say obk.Method1() ---------------------------------------------------------------------- Comment By: Oleg Noga (oleg_noga) Date: 2005-09-21 03:41 Message: Logged In: YES user_id=551440 Note: Visual Basic calls functions of that COM object correctly ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1296632&group_id=78018 |