No, you figured out the best solutions.
<soapbox>
In general, you shouldn't be using "from module import *" except in
special cases. Your problem here is just one of the reasons why; in
general, using this feature means that it is hard to track (at least
for a human reader!) what is meant by a particular name. Exceptions
are those modules that are designed to be used in this way, e.g. the
module "stat" which defines constants like ST_MTIME.
</soapbox>
> ----------------------------------------------------------------------------
>
> The underlying problem is that if I use:
>
> from module import *
>
> or
>
> import * from module
>
> Then the generated exception is dependent on which import method
> was used. I'd like a module error to be 'module.error', independent
> of the import statements, but I'm not sure if this would clash with
> semantics of exceptions in general.
Well, the exception *object* is the same in all cases -- it's just
that the local name you have to use for it differs. With Python, an
object's name is a fairly superficial property -- it may have several
names, or none, and there generally isn't One True Name for every
object.
> Related question, is there a way to get exception's parameters
> without knowing which exception was raised?
Yes -- inside an except clause, use sys.exc_type and sys.exc_value.
--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>