473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

import error

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.

Jul 31 '06 #1
1 1359
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

Jul 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Markus Doering | last post by:
Hello, I just switched from 2.2 to Python 2.3. I am developing an XML/CGI interface to databases as a python package called "unitWrapper" containing several modules which ran fine under v2.2. ...
1
by: jean.rossier | last post by:
Hello All, I am facing a problem while importing pylab library(in a .py program file) via web browser however the same program works when I execute it from the command prompt. my...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
1
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my...
3
by: Neter Smith | last post by:
I have run into a problem when trying to import a WSDL reference under VS 2003 and 1.1 of the framework. It appears as if it is in the generation of the proxy that things are failing. When I...
4
by: Mathias Waack | last post by:
Hi, I've embedded python into a legacy application. It works - most of the time. In some special situations the app crashes executing the "import random". There are two different situations: ...
1
by: baling | last post by:
Hi.... Hi everybody, i have a code that i make in VBA and know I want to use this code in to VB6. But i don't know how to use that code in to VB 6.0 Please correct this code so i can use it in VB...
7
by: Ron Adam | last post by:
from __future__ import absolute_import Is there a way to check if this is working? I get the same results with or without it. Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win 32 ...
2
by: KingoftheKings | last post by:
I'm new here. I want a help with VB codes that will import text or excel files from a specified directory in to an existing or new Access table. I have written some codes, but when I click the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.