On 1 dic, 02:41, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Dec 1, 12:24 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > > Sorry, but this does not work. If there is an ImportError > > during importing the existing module, it won't get inserted > > into sys.modules. I just tried it with a small example. > > Curious, as at least for Python 2.3 it behaves as I described with the > simple examples I tested. I do vaguely remember behaviour related to > this changing though, so possible that newer version works > differently.
Yes. It was changed on 2.4. From http://www.python.org/doc/2.4/whatsnew/node12.html: "Encountering a failure while importing a module no longer leaves a partially-initialized module object in sys.modules. The incomplete module object left behind would fool further imports of the same module into succeeding, leading to confusing errors. (Fixed by Tim Peters.)" -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list