TypeError: 'int' object is not callable

Krishnan Shankar i.am.songoku at gmail.com
Mon Aug 26 23:23:08 EDT 2013


Hi,

The problem is in the second line.

a = time.daylight()

The daylight is not a method in time module. It is clear here,
http://docs.python.org/2/library/time.html

Since it is not a method we cannot call it. It is just a integer variable .
It returns zero if DST timezone is not defined and returns non zero if
defined.

>>> import time
>>> a = time.daylight()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
>>> a = time.daylight
>>> a
0
>>> type(time.daylight)
<type 'int'>

Regards,
Krishnan


On Tue, Aug 27, 2013 at 8:15 AM, <autobotprime.17 at gmail.com> wrote:

> dear friends when i try to execute following lines
>
> import time
> a = time.daylight()
> print(a)
>
>
> result is
> TypeError: 'int' object is not callable
>
>
> why is this error and how can i solve this problem?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130827/fe0ed27e/attachment.html>


More information about the Python-list mailing list