For an unknown reason, datetime.date.today() began throwing a cryptic
"AttributeError: time" exception. It took me a while to figure out
that this was caused by an accidental overriding of the built-in
'time' module.

Here's an example interactive session which shows the problem:

[tal ~]$ touch time.py
[tal ~]$ python
Python 2.5.2 (r252:60911, Jul 17 2008, 10:47:50)
[GCC 4.0.1 (Apple Inc. build 5484)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.__file__
'time.py'
>>> import datetime
>>> datetime.date.today()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: time
>>>

Here I used version 2.5.2, but I checked and this also happens on 2.6.


It this desired behavior?

At the very least the exception should be more detailed, perhaps to
the point of suggesting the probable cause of the error (i.e.
overriding the time module).

- Tal
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to