Steve Holden wrote: > Tal Einat wrote: >> 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?
The difference is that here the exception is generated directly in the C code so you don't get an intelligible traceback. The C code for datetime imports the time module via the Python C API. In other words, here a function from a module in the stdlib, datetime, barfs unexpectedly because I happen to have a file name time.py hanging around in some directory. There is no traceback and no intelligible exception message, just "AttributeError: time". I had to dig through datetime's C code to figure out which module was being imported via the Python C API, which turned out to be time. This is rare enough that I've never had something like this happen to me in seven years of heavy Python programming. - 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