Quoth Brandon Taylor <btaylordes...@gmail.com>: > Ok, the first thing I needed to do was add: > > from __future__ import with_statement at the beginning of my file > > but: > > with zip_file.open(zip_name + '/' + thumbnail_image) as source: > with open(os.path.join(thumbnail_path, > thumbnail_image), 'wb') as target: > shutil.copyfileobj(source, target) > > Returns an error on the first line: > > ZipExtFile instance has no attribute '__exit__' > > Googling this error message is turning up nothing, and there's no > mention of the exception in the docs. Any thoughts?
Yeah, that means the ZipExtFile object hasn't been extended to handle the context management protocol. It would be pretty simple to roll your own for it. Take a look at the contextlib module. --RDM -- http://mail.python.org/mailman/listinfo/python-list