Hi All,

Am I right in thinking this is a bug:

class MyContextManager:

    def __enter__(self):
        pass

    def __exit__(self,t,e,tb):
        print type(t),t
        print type(e),e


with MyContextManager():
   import foo.bar.baz

...when executed, gives me:

<type 'type'> <type 'exceptions.ImportError'>
<type 'str'> No module named foo.bar.baz

Why is 'e' ending up as a string rather than the ImportError object?

This is with Python 2.6.5 if that makes a difference...

Chris

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to