quodlibet / mutagen

Python module for handling audio metadata
https://mutagen.readthedocs.io
GNU General Public License v2.0
1.48k stars 158 forks source link

collections renamed to collections.abc #646

Closed ballynakill-waif closed 1 month ago

ballynakill-waif commented 2 months ago

It seems that there where some changes to the structure of the package, and my usage of pip install doesn't clear it up.

 mutagen-inspect -h
Traceback (most recent call last):
  File "/Users/hecate/.pyenv/versions/3.11.4/bin/mutagen-inspect", line 12, in <module>
    from mutagen._tools.mutagen_inspect import entry_point
  File "/Users/hecate/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_tools/mutagen_inspect.py", line 11, in <module>
    from mutagen._senf import print_, argv
  File "/Users/hecate/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/__init__.py", line 32, in <module>
    from ._stdlib import sep, pathsep, curdir, pardir, altsep, extsep, devnull, \
  File "/Users/hecate/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/_stdlib.py", line 28, in <module>
    from ._environ import environ
  File "/Users/hecate/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/_environ.py", line 133, in <module>
    class Environ(collections.MutableMapping):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'

after fixing the file my self with:

import collections.abc as collections

that's the _environ.py, ~/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/_environ.py. I still receive more errors

mutagen-inspect -h
Traceback \(most recent call last\):
  File \"/Users/hecate/.pyenv/versions/3.11.4/bin/mutagen-inspect\", line 12, in <module>
    from mutagen._tools.mutagen_inspect import entry_point
  File \"/Users/hecate/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_tools/mutagen_inspect.py\", line 11, in <module>
    from mutagen._senf import print_, argv
  File \"/Users/hecate/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/__init__.py\", line 34, in <module>
    from ._argv import argv
  File \"/Users/hecate/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/_argv.py\", line 60, in <module>
    class Argv\(collections.MutableSequence\):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module \'collections\' has no attribute \'MutableSequence\'

which makes me feel like this is a daisy chain of errors that could be better addressed some other way other than changing these files.

note

I had to change both importation lines concerning the module collections to

import collections.abc as collections

in both, ~/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/_argv.py, and ~/.pyenv/versions/3.11.4/lib/python3.11/site-packages/mutagen/_senf/_environ.py in order to get things working -- in order to get the binaries from this package working again. I'm using python 3.11.4 and I use pyenv if that is useful.

phw commented 1 month ago

Can you please check what version of mutagen you are using? From the error logs it looks like you are using 1.42.0 or earlier. Please upgrade to the latest version. collections.abc is supported since mutagen 1.43.0 (releases November 2019), the current latest version is 1.47.0 from September last year.