urllib2 does not implement "with" Python 2.6

Paul Rubin no.email at nospam.invalid
Thu Aug 12 02:14:19 EDT 2010


John Nagle <nagle at animats.com> writes:
> "AttributeError: addinfourl instance has no attribute '__exit__'".
>
> I thought that all the file-like objects supported "with" in 2.6.
> No?

I guess not.  Use contextlib.closing.



More information about the Python-list mailing list