drothlis/stb-tester — pull request #87 by drothlis (2014-01-19 16:17:05+00:00)
Title: stbt.ocr: Avoid leaking file descriptors

This avoids leaking file descriptors[1], and is neater because
`NamedTemporaryFile` handles removing the files after us.

Also set a filename prefix of "stbt-ocr-" in case some files get left
behind in /tmp, so that you can easily identify the culprit. (As
suggested by Will Manley.)

Note that we already use multiple "with" expressions elsewhere in
stbt.py, so this isn't introducing a new incompatibility with python
2.6.

I had real trouble getting a `with` statement split over multiple lines
to look nice *and* comply with pylint, so I need to use
`functools.partial` to make the `with` expressions shorter.

[1] http://www.logilab.org/blogentry/17873