Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't be error verbose in mid3v2, when no ID3 found #219

Closed
lazka opened this issue Apr 11, 2015 · 3 comments
Closed

Don't be error verbose in mid3v2, when no ID3 found #219

lazka opened this issue Apr 11, 2015 · 3 comments
Labels

Comments

@lazka
Copy link
Member

@lazka lazka commented Apr 11, 2015

Originally reported by: Systems Rebooter . (Bitbucket: systems_rebooter, GitHub: Unknown)


Hey,

When there is no id3 found mid3v2 stack-tracing with exception.
Human readable output like no tag found would be nice here :)

mid3v2 / eyeD3 examples below:

$ mid3v2 test.mp3

IDv2 tag info for test.mp3
Traceback (most recent call last):
  File "/bin/mid3v2", line 222, in list_tags
    id3 = mutagen.id3.ID3(filename, translate=False)
  File "/usr/lib/python3.3/site-packages/mutagen/id3/__init__.py", line 187, in __init__
    super(ID3, self).__init__(*args, **kwargs)
  File "/usr/lib/python3.3/site-packages/mutagen/_util.py", line 203, in __init__
    super(DictProxy, self).__init__(*args, **kwargs)
  File "/usr/lib/python3.3/site-packages/mutagen/_tags.py", line 18, in __init__
    self.load(*args, **kwargs)
  File "/usr/lib/python3.3/site-packages/mutagen/id3/__init__.py", line 255, in load
    self._header = ID3Header(fileobj)
  File "/usr/lib/python3.3/site-packages/mutagen/id3/__init__.py", line 108, in __init__
    raise ID3NoHeaderError("%r doesn't start with an ID3 tag" % fn)
mutagen.id3._util.ID3NoHeaderError: 'test.mp3' doesn't start with an ID3 tag

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/mid3v2", line 349, in <module>
    main(sys.argv)
  File "/bin/mid3v2", line 333, in main
    list_tags(args)
  File "/bin/mid3v2", line 223, in list_tags
    except StandardError as err:
NameError: global name 'StandardError' is not defined
$ eyeD3 test.mp3

test.mp3    [ 720.00 Bytes ]
-------------------------------------------------------------------------------
Time: 00:00 MPEG2, Layer III    [ 32 kb/s @ 16000 Hz - Joint stereo ]
-------------------------------------------------------------------------------
No ID3 v1.x/v2.x tag found!

Thanks!


@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Apr 11, 2015

Original comment by Systems Rebooter . (Bitbucket: systems_rebooter, GitHub: Unknown):


Just debugged it. Issue happens on python 3 only. For 2.7 - output is nice and human-readable :)

$ head -1 `which mid3v2`
#!/usr/bin/python3
$ head -1 `which mid3v2`
#!/usr/bin/python
$ mid3v2 test.mp3
IDv2 tag info for test.mp3
'test.mp3' doesn't start with an ID3 tag
$
$ python3 --version
Python 3.3.2
$ python --version
Python 2.7.5

pip has been linked to python 3.3 by default in CentOS 7, instead of pythong 2.7, but this has been fixed in upcoming version of it:

$ pip --version; pip freeze | grep mutagen
pip 6.0.8 from /usr/lib/python3.3/site-packages/pip-6.0.8-py3.3.egg (python 3.3)
You are using pip version 6.0.8, however version 6.1.1 is available.
mutagen==1.28
$ pip2 --version; pip2 freeze | grep mutagen
pip 6.0.8 from /usr/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg (python 2.7)
You are using pip version 6.0.8, however version 6.1.1 is available.
mutagen==1.28
Successfully installed pip-6.1.1
$ pip --version; pip freeze | grep mutagen
pip 6.1.1 from /usr/lib/python2.7/site-packages (python 2.7)
mutagen==1.28
$ pip3 --version; pip freeze | grep mutagen
pip 6.1.1 from /usr/lib/python3.3/site-packages (python 3.3)
mutagen==1.28
@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Apr 20, 2015

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


mid3v2/py3: Fix error when file has no tags. (Fixes issue #219)

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Apr 20, 2015

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.