On 2011/11/21 07:54 AM, [email protected] wrote:

Hi All,

Please look at the following snippet.

{{{

# User defined modules

try:

    from scripts import precheck

    from scripts import validate

    from scripts import constants

except ImportError:

print("ERROR: One of the modules (..scripts/precheck.py, validate.py, constants) is not present.")

print("INFO : Please verify the above modules, and restart the installation")

    sys.exit(1)

}}}

See the red line.
I want to get the name of the particular module which is not available and hence causing ImportError.

One of the ways can be to get the STDERR and process it using re. !?

Is there a better alternate available .?

Thanks

Nikunj



_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
>>> try:
...     import nothing
... except ImportError, err_msg:
...     print err_msg
...
No module named nothing

Hope that helps.
--

Christian Witts
Python Developer
//
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to