Get the name of the current module that has been failed to import
Question: i need help to get the name of the not imported module while doing that

so the code is:

    
    
    #!/usr/bin/env python
    bla=[]
    try:
        import os
        import sys
        import somethings
        import blabla
    except:
        bla.append(NOT_IMPORTED_MODULE_NAME) # it should be here
    if len(bla)>0:
        exit("not imported:%s" % " ".join(bla))
    

thank you in advance


Answer: Although what I am going to say is more appropriate as comment, I am just
typing here since I was not allowed comment due to low reputation number.
(since I am very new here)

Let's say you have sys and blabla module missing. With current setting it will
throw exception when it tried to load sys. And it will not even reach `import
blabla`. So you wouldn't know if the module missing or not if previous module
is missing. If you really really want the feature you want, you can wrap every
single `import module` with exception handling for all module import. But it
seems to me that's over kill. As idjaw mentioned, you should be able to see
from stacktrace if any module is missing.

