Tal Einat wrote: > 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). > How is this different from any other case where you import a module with a standard library name conflict, thereby confusing modules loaded later standard library. Should we do the same for any error induced in such a way?
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ _______________________________________________ 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