mp3-tagger icon indicating copy to clipboard operation
mp3-tagger copied to clipboard

AttributeError: 'NoneType' object has no attribute 'group'

Open wodim opened this issue 4 years ago • 5 comments

When using get_tags on this mp3 file.

GB89-128 Voodoo Ray - A Guy Called Gerald.zip

Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\id3.py", line 178, in _unpack_bytes
    val = int(val)
ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sorter.py", line 41, in <module>
    mp3s[file] = mp3.get_tags()
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\mp3.py", line 141, in get_tags
    tmp_dict[tag.title] = tag.value
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\id3.py", line 40, in value
    val = self._unpack_bytes()
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\id3.py", line 183, in _unpack_bytes
    val = int(re.search(r'\d+', val).group(0))
AttributeError: 'NoneType' object has no attribute 'group'

wodim avatar Jun 18 '20 15:06 wodim

i have pretty much the same issue on ubuntu. thanfully i can still edit tags, it's just get_tags that doesn't work

ohnekopf avatar Dec 24 '20 05:12 ohnekopf

Change line 176 in id3.py from

    if self.title == 'genre':
    

to

    if self.title == 'genre' and len(val):
    

It's crashing when val is empty.

TheBengineer avatar May 07 '21 23:05 TheBengineer

Added a pull here: https://github.com/artcom-net/mp3-tagger/pull/13

TheBengineer avatar May 07 '21 23:05 TheBengineer

Change line 176 in id3.py from

    if self.title == 'genre':

to

    if self.title == 'genre' and len(val):

It's crashing when val is empty.

This will handle only if genre is empty.. what about if it is having string instead of integer?

I am having many mp3 files, where genre is with some other strings.

kk-hiraskar avatar Jul 12 '21 09:07 kk-hiraskar

Already issue is fixed and committed: fix diff

please release it on https://pypi.org/project/mp3-tagger/

kk-hiraskar avatar Jul 12 '21 09:07 kk-hiraskar