xml.dom's weirdness?

Lie Lie.1296 at gmail.com
Sun Jul 27 11:08:00 CEST 2008

On Jul 27, 3:48 pm, Stefan Behnel <stefan... at behnel.de> wrote:
> Lie wrote:
> > Question: Is there a way to list loaded modules, including those that
> > aren't in my namespace?
> such as sys.modules?
> Modules are not unloaded automatically just because you do not use them
> yourselves.

I'm not surprised of that.

> If the module is imported for whatever reason by whatever other
> module, it stays alive until it's no longer referenced (including the
> reference in sys.modules).

I'm more concerned about the number of modules imported by making an
error (from 30 on the startup to 187) and the side-effect of making an
error, which makes modules such as xml.*/email.* that previously
doesn't exist get imported out of the blue... this makes the effect
that made me start the thread, a "command" that while getting
NameError in the first call, gets a modules found on subsequent call,
just because the Error Handler loaded it for you.

I'm even more concerned by a few modules that got imported because of
making the error, several of them isn't something that should be used
by Error Handler (e.g. email.*, apt (seems to be related to Ubuntu's
package manager of the same name), etc)

I'm also concerned in that why Error handling is on python's level
instead of built-in.

PS: These concerns are based on the assumption that the offender is
the "Error Handler", which I haven't proven completely, yet is the
strongest candidate on why this odd behavior comes to be.

More information about the Python-list mailing list