My 'time' module is broken, unsure of cause

Jean-Paul Calderone exarkun at divmod.com
Thu Aug 23 19:31:05 CEST 2007


On Thu, 23 Aug 2007 11:22:55 -0600, darren kirby <bulliver at badcomputer.org> wrote:
>Hi all,
>
>I have a strange error here and I am unsure how to further investigate it:
>
>Python 2.4.4 (#1, Aug 23 2007, 10:51:29)
>[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
>>>> import time
>40:42:0
>>>> now = time.time()
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>AttributeError: 'module' object has no attribute 'time'
>
>Notice the '40:42:0' that always gets output. I searched Gentoo's bugzilla but
>can not see anything relevant. I rebuilt python but the behavior recurs. I am
>unsure if the issue is with Python, Gentoo, or perhaps with the underlying
>lib (presumably glibc) that Python uses for the time module. This is working
>fine on another machine (also 2.4.4, GCC 3.4.6,  Gentoo Hardened).

    exarkun at charm:~$ echo "print '40:42:0'" > time.py
    exarkun at charm:~$ python
    Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
    [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import time
    40:42:0
    >>> time.time()
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    AttributeError: 'module' object has no attribute 'time'
    >>> print time.__file__
    time.py
    >>> ^D
    exarkun at charm:~$ rm time.py
    exarkun at charm:~$ rm time.pyc
    exarkun at charm:~$ python
    Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
    [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import time
    >>> time.time()
    1187890226.9293921
    >>> print time.__file__
    /usr/lib/python2.4/lib-dynload/time.so
    >>>

Jean-Paul



More information about the Python-list mailing list