python __import__ question
bignose+hates-spam at benfinney.id.au
Thu May 25 07:15:11 CEST 2006
Evgeniy Zamriy <codebuger at gmail.com> writes:
> I have this code:
> empty_mod = __import__(some_empty_module)
> except ImportError:
> print "test"
> But python doesn't work with this except:
> ImportError: No module named ....
Your example is incomplete.
... empty_mod = __import__(some_empty_module)
... except ImportError:
... print "test"
Traceback (most recent call last):
File "<stdin>", line 2, in ?
NameError: name 'some_empty_module' is not defined
Can you post a minimal, complete example that shows the behaviour?
\ "As we enjoy great advantages from the inventions of others, we |
`\ should be glad to serve others by any invention of ours." -- |
_o__) Benjamin Franklin |
More information about the Python-list