mimicking a file in memory

p. ppetrick at gmail.com
Tue Nov 20 15:08:09 EST 2007


I am using the mutagen module to extract id3 information from mp3
files. In order to do this, you give mutagen a filename, which it
converts into a file object using the python built-in "file" function.

Unfortunately, my mp3 files don't live locally. They are on a number
of remote servers which I access using urllib2.

Here is my dilemma:
I don't want to copy the files into a local directory for mutagen's
sake, only to have to remove them afterward. Instead, I'd like to load
the files into memory and still be able to hand the built-in "file"
function a filename to access the file in memory.

Any ideas on how to do this?



More information about the Python-list mailing list