import error

Simon Forman rogue_pedro at yahoo.com
Mon Jul 31 14:46:16 EDT 2006


cheeky wrote:
> Hi, all.
>
> I now really like to program with Python, even though I'm a newbie. I
> have difficulty in solving the following problem.
>
> $ python
> Traceback (most recent call last):
>   File "x.py", line 6, in ?
>     import calendar, time
>   File "time.py", line 5, in ?
>     now = time.time()
> TypeError: 'module' object is not callable
>
> I now see the above error message. The source code is the following.
>
> $ cat -n x.py
>      1  #!/usr/bin/python
>      2
>      3  import traceback
>      4
>      5  from datetime import date
>      6  import calendar, time
>
> I don't have the line now = time.time() which encountered an error in
> the previous step. I removed that line but I still see the error.
>
> Someone says I should reload time module. However, I can't even import
> time module. That's why I can't even try to reload time module name.
>
> What's wrong with me? I'm studying on Ubuntu Linux. On Window IDLE
> doesn't seem to have this problem. I saw someone saying it could be
> happening when running independent script. I don't know what is right.
>
> I really would like to know what is going on my system and how to clear
> the past information. Thank you.

It looks like you might have a file named 'time.py' in the same
directory as your 'x.py'.  If so, move it away (or rename it) and try
again.

HTH,
~Simon




More information about the Python-list mailing list