On 15 November 2011 17:24, Chris Kaynor <ckay...@zindagigames.com> wrote:

> As with any Python code, you can wrap the import into a try: except block.
>
> try:
>  import badModule
> except:
>



>  pass # Or otherwise handle the exception - possibly importing an
> alternative module.
>
>
Hmm, I know this might sound silly, but if it fails I still want to import
the module and disable those lines of code that are related to the reason
while the module failed to be imported in the first place.  Even if that
makes the code not 100% correct.

Does that make sense ?









> As with any except statement, specific exceptions may be caught
> (rather than the blank, catch everything).
>
> Chris
>
> On Tue, Nov 15, 2011 at 9:11 AM, Andreea Babiuc <babiucandr...@gmail.com>
> wrote:
> > Hi,
> >
> > Is there a way to suppress all the errors when importing a module in
> python?
> >
> > By that I mean.. If I have other imports in the module I'm trying to
> import
> > that fail, I still want my module to be imported that way..
> >
> > Many thanks.
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
> >
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Blog: Http://andreeababiuc.ro
Photo Portfolio: http://royaa.daportfolio.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to