[Tutor] Error: 'IndexedVar' object is not callable

Steven D'Aprano steve at pearwood.info
Fri Sep 9 21:13:39 EDT 2016


Hi Pooja, and welcome!


On Fri, Sep 09, 2016 at 02:50:57PM -0400, Pooja Bhalode wrote:
> Hi everyone,
> 
> I was getting this error which read ' 'IndexedVar' object is not callable '
> for a variable type.
> 
> The variable is defined as a class variable and has dimensions m.C(i,j) in
> z and t axis.

I'm afraid I have no idea what you are talking about here. What is an 
IndexedVar object? What does "dimensions m.C(i,j) in z and t axis" mean?

Is this from some third-party library? Which one?

I would help if you show us the actual code you are trying to run. Not 
your entire application, especially if it is big, but enough of the code 
that we can understand the context. Please read this article first for 
how you can improve the chances of getting good answers to your 
questions:

http://sscce.org/

> ERROR: Rule failed when generating expression for constraint concentration
> with index (10, 10):
> TypeError: 'IndexedVar' object is not callable
> ERROR: Constructing component 'concentration' from data=None failed:
> TypeError: 'IndexedVar' object is not callable


These do not look like standard Python errors. I would expect to see a 
traceback, which may look something like this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/random.py", line 298, in sample
    raise TypeError("Population must be a sequence or set.  For dicts, use list(d).")
TypeError: Population must be a sequence or set.  For dicts, use list(d).


How are you running this code?

My *wild-guess* is that if you change m.C(i, j) to m.C[i, j] it might 
fix this specific error, but it really is a guess.


-- 
Steve


More information about the Tutor mailing list