Re: [Jython-users] partial imports
by Kevin Butler other posts by this author
Feb 27 2002 10:40PM messages near this date
Re: [Jython-users] partial imports
|
[Jython-users] How to use the execute() method in javaos
Samuele Pedroni wrote:
> From: <Matt_Conway@[...].com>
> > >>> import a
> > ...NameError...
> > >>> import a
> > >>> a.foo
> Is the BDFL (Guido van Rossum) intended behavior,
>
> the point is that, if an import fails somehow, you are on your own,
> if you know how to cleanup things you can do that explicitly
>
...
> the precise rationale is something also Guido continously forget
> about.
I've found it quite handy helping to debug the problem that caused the error.
import x
<error>
from x import *
<look at values that led to the failure...>
It is easy enough to re-execute the failed import with the reload() function:
import x
<error>
import x
reload( x ) # executes your fixed code, or triggers the failure again.
Standard caveats about Python's non-recursive reload() apply. :-)
kb
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
Thread:
Samuele Pedroni
Kevin Butler
|