Reading external files or internal data

Hans-Joachim Widmaier hjwidmaier at web.de
Mon Aug 11 03:21:39 EDT 2003


Hi,

I have a class that reads most common files (text, images, tar
archives, zip archives). I just read in the whole thing and decide
then what to do with it - create a gtk.TextView, gdk.pixbuf, or
tables-of-contents, whatever. Looking at the functions in the
appropriate modules shows that most of them want to read from external
files. Some take file-like objects, others don't. And tarfile allows
it for gzip compressed archives, but not for bzip2 compressed ones.
This is not only horribly inconsistent, it's also ugly. I do not want
to read an external file over and over again. (If I'd read from
standard input, I'd have to create a temporary file - yuck!) I want to
deal just *once* with all the errors that can occur while reading the
file.

What am I missing?

Hans-Joachim Widmaier




More information about the Python-list mailing list