I was writing a little script to test different functions of the time
module. Like an idiot, I named the test script time.py.
Then when I tried to do a "import time" call, I got an error.
So, my time.py has overwritten the time.py builtin mod.
I have python 2.3 installed on a few different servers, so I was going to
copy over the .py file in /usr/local/lib/python2.3, but I could not find
one... not even on the servers where I didn't screw this up.
$ find . -name "time*"
../python2.3/timeit.py
../python2.3/timeit.pyc
../python2.3/timeit.pyo
../python2.3/lib-dynload/time.so
Where is the original time.py kept? And is there an easier way to get it
back?
Thanks and sorry about my ignorance. 2 1286
On Wed, 20 Oct 2004 11:49:58 -0700, Sean Berry <se**@buildingonline.com> wrote: I was writing a little script to test different functions of the time module. Like an idiot, I named the test script time.py.
Then when I tried to do a "import time" call, I got an error.
So, my time.py has overwritten the time.py builtin mod.
Your problem may be a little bit simpler to solve. When you do a
'import time' is looks first in the current directory; if it doesn't
find a module by that name, it searches the module path (I forgot the
name), which usually on Unix points to the lib subdirectory of your
Python installation. It appears that you own (broken) time.py module
is just getting the precedence over the standard one. If that's the
case, just removing your own time.py (or renaming it) should solve
your problem.
--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: ca********@gmail.com
mail: ca********@yahoo.com
> On Wed, 20 Oct 2004 11:49:58 -0700, Sean Berry <se**@buildingonline.com> wrote: I was writing a little script to test different functions of the time module. Like an idiot, I named the test script time.py.
Then when I tried to do a "import time" call, I got an error.
So, my time.py has overwritten the time.py builtin mod.
Your problem may be a little bit simpler to solve. When you do a 'import time' is looks first in the current directory; if it doesn't find a module by that name, it searches the module path (I forgot the name), which usually on Unix points to the lib subdirectory of your Python installation. It appears that you own (broken) time.py module is just getting the precedence over the standard one. If that's the case, just removing your own time.py (or renaming it) should solve your problem.
Thanks for the heads up. I had already tried that, but I did not realize
that the .pyc file had been compiled and was in the directory as well.
Deleted it and all is fine.
Thanks Carlos. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Paul Rubin |
last post by:
http://www.nightsong.com/phr/python/sharandom.c
This is intended to be less predicable/have fewer correlations than
the default Mersenne Twister or Wichmann-Hill generators. Comments
are...
|
by: myang |
last post by:
How can I know a module take how much time? Thanks for any hints.
Regards,
Yang
|
by: Alan Toppen |
last post by:
I was unable to use the ZipFile class in the zipfile module in Python2.4. I
got an error that zlib could not be found. Comparing my Python 2.2
installation I noticed Python 2.4 was missing a...
|
by: Carl |
last post by:
Hi,
I tried to print a document with the window.print method, but with netscape
7, i always get the error:"the page was replaced while you was trying to
print. Try again". I see "mydoc.htm" and...
|
by: tchangmian |
last post by:
Hi, I would like to create an auto-lock out module where users are
unable to continue login attempt after 3-5 unsuccessful logins. In
addition, the user account are automatically suspended after...
|
by: David Bear |
last post by:
I'm attempting to use the cgi module with code like this:
import cgi
fo = cgi.FieldStorage()
# form field names are in the form if 'name:part'
keys = fo.keys()
for i in keys:
try:...
|
by: rjcarr |
last post by:
Sorry if this is a completely newbie question ...
I was trying to get information about the logging.handlers module, so
I imported logging, and tried dir(logging.handlers), but got:
...
|
by: Ron Adam |
last post by:
I'm having some cross platform issues with timing loops. It seems
time.time is better for some computers/platforms and time.clock others, but
it's not always clear which, so I came up with the...
|
by: jm |
last post by:
Hi, before I build something in it, I wanted to know if it's about to
be replaced or if I should use something else. Also, does anyone know
the bad points or things to avoid when using webparts? ...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |