Namedtuples: TypeError: 'str' object is not callable

Deborah Swanson python at deborahswanson.net
Sat Jan 7 00:07:13 EST 2017


Chris Angelico wrote, on January 06, 2017 8:05 PM
> To: python-list at python.org
> Subject: Re: Namedtuples: TypeError: 'str' object is not callable
> 
> 
> On Sat, Jan 7, 2017 at 2:46 PM, Deborah Swanson 
> <python at deborahswanson.net> wrote:
> > And here's the Traceback in PyCharm:
> >   File "E:/Coding projects/Pycharm/Moving/moving_numberedtuples.py",
> > line 139, in moving()
> >     for lst in map(listings._make, csv.reader(open('E:\\Coding 
> > projects\\Pycharm\\Moving\\Moving 2017 in.csv',"r"))):
> > TypeError: 'str' object is not callable
> >
> > What str object is not callable, and how do I fix it?
> 
> Toss in a 'print' above that. You're calling map and open 
> (and csv.reader, but I doubt you've shadowed that). My money 
> would be on 'map' having been assigned something.
> 
> ChrisA

And you would be precisely correct. I have a variable named 'map', and I
intended to delete it and the code that used it, but totally forgot
about it. It's still in there somewhere, but a simple search will find
it.

I really don't know how long it would've taken me to think of that, so
thank you!

Deborah




More information about the Python-list mailing list