Python 3 compatibilty

Issue #25 resolved
Moritz Kiefer
created an issue

It would be great if you could add compability with python 3. I can take a look at it myself next time I have time.

Comments (28)

  1. Travis Shirk repo owner

    It's on the radar for sure Moritz. The next release will have support for 2.6, so some of the foundations for a more portable lib are in place.. including tox tests.

  2. flyingrub
    • i own a little script wich is written on python3 and is ready for your next release :)
    • Do you have a workaround to use your tool easily with mine for now ? (install it by hand is the easiest way ?)

    • i know it's not cool to ask for eta but : Do you know when it will approximately be ready ?

  3. flyingrub
    fly@Minotoor:~/Musique$ l
    Saje - Take Care Of You.mp3
    fly@Minotoor:~/Musique$ python3
    Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
    [GCC 4.8.2] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import eyed3
    >>> audiofile = eyed3.load('Saje - Take Care Of You.mp3')
    >>> audiofile.tag.artist = 'test'
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'NoneType' object has no attribute 'artist'
  4. Travis Shirk repo owner

    I assume the file has a tag. If not, tag is None (call audiofile.initTag). If there is a tag in the file I'd like have the file to test. Your use case works fine for me.

  5. flyingrub
    fly@Minotoor ~/Musique/test $ python3
    Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
    [GCC 4.8.2] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import eyed3
    >>> audiofile = eyed3.load('Saje - Take Care Of You.mp3')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.4/dist-packages/eyeD3-0.7.5-py3.4.egg/eyed3/", line 90, in load
        return mp3.Mp3AudioFile(path, tag_version)
      File "/usr/local/lib/python3.4/dist-packages/eyeD3-0.7.5-py3.4.egg/eyed3/mp3/", line 165, in __init__
        core.AudioFile.__init__(self, path)
      File "/usr/local/lib/python3.4/dist-packages/eyeD3-0.7.5-py3.4.egg/eyed3/", line 245, in __init__
      File "/usr/local/lib/python3.4/dist-packages/eyeD3-0.7.5-py3.4.egg/eyed3/mp3/", line 183, in _read
        self._info = Mp3AudioInfo(file_obj, mp3_offset, self._tag)
      File "/usr/local/lib/python3.4/dist-packages/eyeD3-0.7.5-py3.4.egg/eyed3/mp3/", line 95, in __init__
        if not self.xing_header.decode(mp3_frame):
      File "/usr/local/lib/python3.4/dist-packages/eyeD3-0.7.5-py3.4.egg/eyed3/mp3/", line 312, in decode
        version = (ord(frame[1]) >> 3) & 0x1
    TypeError: ord() expected string of length 1, but int found

    now i have this and i didn't change anything ....?

  6. flyingrub

    ok, i removed the one i installed with pip and now it's good. :) thanks

    a last one question : how can we edit the mp3 artwork with your module ?

    EDIT : while it works fine one my mint laptop on my raspberry pi it fail here :

    fly@raspberry-pi:~/workspace/eyed3/nicfit-eyed3-a95f6ccd6388$ python3 install
    Traceback (most recent call last):
      File "", line 10, in <module>
      File "", line 885, in main
      File "", line 853, in _launch_pavement
      File "", line 35
        PROJECT = u"eyeD3"
    SyntaxError: invalid syntax
    fly@raspberry-pi:~/workspace/eyed3/nicfit-eyed3-a95f6ccd6388$ python3
    Python 3.2.3 (default, Mar  1 2013, 11:53:50) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.

    the only difference i see is that i have Python 3.4.0 (default, Apr 11 2014, 13:05:11) on my laptop ...

  7. Lucky Donald

    Got some python 3 problems here:

    Connected to pydev debugger (build 139.1659)
    Traceback (most recent call last):
      File "/Applications/", line 2217, in <module>
        globals =['file'], None, None)
      File "/Applications/", line 1643, in run
        pydev_imports.execfile(file, globals, locals)  # execute the script
      File "/Applications/", line 18, in execfile
        exec(compile(contents+"\n", file, 'exec'), glob, loc) 
      File "/Users/luckydonald/Documents/Programmieren/Python/PonyMusicDownloader/PonyMusicDownloader/", line 158, in <module>
      File "/Users/luckydonald/Documents/Programmieren/Python/PonyMusicDownloader/PonyMusicDownloader/sites/ponyFm/", line 28, in get_metadata
      File "/Users/luckydonald/Documents/Programmieren/Python/virtualenv3.4.3_brew.venv/lib/python3.4/site-packages/eyed3/id3/", line 772, in save
        self._saveV2Tag(version, encoding, max_padding)
      File "/Users/luckydonald/Documents/Programmieren/Python/virtualenv3.4.3_brew.venv/lib/python3.4/site-packages/eyed3/id3/", line 966, in _saveV2Tag
      File "/Users/luckydonald/Documents/Programmieren/Python/virtualenv3.4.3_brew.venv/lib/python3.4/site-packages/eyed3/id3/", line 926, in _render
        header_data = self.header.render(total_size - TagHeader.SIZE)
      File "/Users/luckydonald/Documents/Programmieren/Python/virtualenv3.4.3_brew.venv/lib/python3.4/site-packages/eyed3/id3/", line 136, in render
        data += chr(self.minor_version) + chr(self.rev_version)
    TypeError: can't concat bytes to str

    screenshot 2015-08-10 um 17.50.06.png (last line, .save()) all it needs is wrapping it in bytes()

     data +=  bytes(chr(self.minor_version) + chr(self.rev_version), "ascii")

    Edit: I didn't saw the py3 branch

  8. Дмитрий Орлов

    oh, I just found the soltion. in my system, 'python' is a symlink to 'python3'. but your seems to think that I'm using python2 when I type in 'python install'. when I do 'python3 install', it's ok. sorry

  9. Travis Shirk repo owner

    Hi Dmitry,

    Thanks for info, I wonder if there is something in that needs updating? Python3 has been the default 'python' on my system for awhile and I've not have problems, but I have not installed devel system-wide, only in venvs.


  10. Log in to comment