Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53026 > unrolled thread

TypeError: 'int' object is not callable

Started byautobotprime.17@gmail.com
First post2013-08-26 19:45 -0700
Last post2013-08-27 04:12 -0400
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  TypeError: 'int' object is not callable autobotprime.17@gmail.com - 2013-08-26 19:45 -0700
    Re: TypeError: 'int' object is not callable Krishnan Shankar <i.am.songoku@gmail.com> - 2013-08-27 08:53 +0530
    Re: TypeError: 'int' object is not callable Terry Reedy <tjreedy@udel.edu> - 2013-08-27 04:12 -0400

#53026 — TypeError: 'int' object is not callable

Fromautobotprime.17@gmail.com
Date2013-08-26 19:45 -0700
SubjectTypeError: 'int' object is not callable
Message-ID<f4dd4f8e-a694-4a86-b2ff-1d91a9b37792@googlegroups.com>
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?

[toc] | [next] | [standalone]


#53027

FromKrishnan Shankar <i.am.songoku@gmail.com>
Date2013-08-27 08:53 +0530
Message-ID<mailman.253.1377573795.19984.python-list@python.org>
In reply to#53026

[Multipart message — attachments visible in raw view] — view raw

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@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
>

[toc] | [prev] | [next] | [standalone]


#53036

FromTerry Reedy <tjreedy@udel.edu>
Date2013-08-27 04:12 -0400
Message-ID<mailman.258.1377591174.19984.python-list@python.org>
In reply to#53026
On 8/26/2013 10:45 PM, autobotprime.17@gmail.com wrote:
> dear friends when i try to execute following lines
>
> import time
> a = time.daylight()
> print(a)
>
>
> result is

You left out the traceback that shows which line had the error. In this 
case, Krishnan could tell, but in other code snippets people post, it is 
not always so obvious. Post the whole trackeback with errors. It is 
printed for a reason ;-)

> TypeError: 'int' object is not callable
>
>
> why is this error and how can i solve this problem?
>


-- 
Terry Jan Reedy

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web