no inputstream?

MRAB google at mrabarnett.plus.com
Thu May 15 18:18:57 EDT 2008


On May 15, 9:00 pm, max <maxwell.newla... at gmail.com> wrote:
> you're right, my java implementation does indeed parse for Id3v2
> (sorry for the confusion).  i'm using the getrawid3v2() method of this
> bitstream class (http://www.javazoom.net/javalayer/docs/docs0.4/
> javazoom/jl/decoder/Bitstream.html) to return an inputstream that then
> i buffer and parse.  apologies if i misrepresented my code!
>
> back to python, i wonder if i'm misusing the mutagen id3 module.  this
> brief tutorial (http://www.sacredchao.net/quodlibet/wiki/Development/
> Mutagen/Tutorial) leads me to believe that something like this might
> work:
>
> from mutagen.mp3 import MP3
> id3tags = MP3(urllib2.urlopen(URL))
>
> but this gives me the following TypeError: "coercing to Unicode: need
> string or buffer, instance found".  does this mean i need to convert
> the "file-like object" that is returned by urlopen() into a unicode
> object?  if so, do i just decode() with 'utf-8', or is this more
> complex?  as of now, doing so gives me mostly "No such file or
> directory" errors, with a few HTTP 404s.
>
[snip]
I think it's expecting the path of the MP3 but you're giving it the
contents.



More information about the Python-list mailing list