[python-win32] Problem with built-in str() function

Andrew Bennetts andrew@puzzling.org
Tue, 11 Jun 2002 13:10:52 +1000


On Mon, Jun 10, 2002 at 07:53:12PM -0700, John Hopkins wrote:
> I get the following output:
> 
> items[x][2] = 3
> Traceback (most recent call last):
>   File "LabTracker_Dev.py", line 356, in OnFindClick
>     self.SearchList.SetStringItem(x, 2, str(items[x][2]))
> TypeError: 'str' object is not callable
> 
>  This is so basic that I'm utterly lost.
> 
> I feel silly, but can anybody help me with this?

Search for "str = " or "def ...(..., str, ...)" in your source.  You
almost certainly are using "str" as a variable, thus overriding the
builtin.  Perhaps pychecker (http://pychecker.sf.net/) might help you
find where you've overridden str -- but I'm not sure if it does that.

-Andrew.