On 09/09/16 19:50, Pooja Bhalode wrote: > I was getting this error which read ' 'IndexedVar' object is not callable ' > for a variable type.
Python error messages are very informative, but only if we can see them. Please post the entire error message not just a summary. > The variable is defined as a class variable and has dimensions m.C(i,j) in > z and t axis. Python variables are just names that reference objects, so variables do not have any type per se, rather they take the type of whatever they are currently referencing. > Could someone please tell me the possible reasons for this happening. "not callable" means that you are trying to call the variable (using parens (...) ) on a variable that is not callable, in this case an IndexedVar - whatever that is; it's not part of the standard Python language so you are presumably using some kind of third party add-on, (possibly SciPy?). It will help if you tell us which libraries you are using. Anyway, its most likely that you have assigned a variable to something you expected to be a callable but is in fact an IndexedVar. This could, for example, be the parameter of a function and you have passed in the wrong kind of data, or it could be the return value from a function that you assign to your variable. > 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 Those don't look like Python error messages. How are you running this code? If it is an IDE then it may be contributing to the confusion. Also we can only guess what your code looks like. Please post the code causing the error. As a minimum the function/method involved. If possible all of it (if less than ~100 lines?). And please post the entire error message, plus a note of your Python version and whatever library you are using. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor