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

incomplete escape \U at position 3 #38

Open
kenny070287 opened this issue Oct 27, 2023 · 4 comments · May be fixed by #93
Open

incomplete escape \U at position 3 #38

kenny070287 opened this issue Oct 27, 2023 · 4 comments · May be fixed by #93

Comments

@kenny070287
Copy link

having this issue when downloading from this link: https://open.spotify.com/album/7D2DrBRs922elDgsyNrqjA?si=GZAHGHmhTwOe6j2bozmutQ

incomplete escape \U at position 3

Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\zotify\track.py", line 190, in download_track
    c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}_', str(file))]) + 1
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\zotify\track.py", line 190, in <listcomp>
    c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}_', str(file))]) + 1
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\re\__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\re\__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\re\_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\re\_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\re\_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\re\_parser.py", line 539, in _parse
    code = _escape(source, this, state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\re\_parser.py", line 393, in _escape
    raise source.error("incomplete escape %s" % escape, len(escape))
re.error: incomplete escape \U at position 3
@famousfive1
Copy link

I am facing the same problem. I tried removing those failed entries from .song_ids and .song_archive but no luck.

@ray2301
Copy link

ray2301 commented Dec 3, 2023

i had a few escape \M problems with the same line from your traceback.
try to replace this in track.py (line 190):
c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}_', str(file))]) + 1
with:
c = len([file for file in Path(filedir).iterdir() if re.search(fr'^{re.escape(str(filename))}_', str(file))]) + 1

it's the special characters it can't write to the filename (: is the problem here probably - you can't have a filename with : or ? for example). this will remove them from the filename so the file can be created but leave the tags correctly written.
i can confirm i can download it.

edit: you could also add
--output "D:/Music/Dreamcatcher - Apocalipse From us/{track_number}.{ext}"
at the end of your command, where you point to your download directory, name the album manually and write only track number in the desired directory. that should also write the files correctly. you can then use mp3tag or some other similar software to rename them as you usually do.

@pettaa123
Copy link

same issue here with

@shinji257
Copy link

I've hit into this. Here is an example of an album that might trigger it...
00vb6sViDbJLmLLchfbRh4

bad escape \M at position 3

Traceback (most recent call last):
  File "C:\Users\shinj\AppData\Local\pipx\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 190, in download_track
    c = len([file for file in Path(filedir).iterdir() if re.search(f'^{filename}_', str(file))]) + 1
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shinj\scoop\apps\python\current\Lib\re\__init__.py", line 177, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shinj\scoop\apps\python\current\Lib\re\__init__.py", line 307, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shinj\scoop\apps\python\current\Lib\re\_compiler.py", line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shinj\scoop\apps\python\current\Lib\re\_parser.py", line 979, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shinj\scoop\apps\python\current\Lib\re\_parser.py", line 460, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shinj\scoop\apps\python\current\Lib\re\_parser.py", line 544, in _parse
    code = _escape(source, this, state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shinj\scoop\apps\python\current\Lib\re\_parser.py", line 443, in _escape
    raise source.error("bad escape %s" % escape, len(escape))
re.error: bad escape \M at position 3

Ends up happening on track 2 for this one for me but it might be different for others. If it triggers it does so consistently. What I usually end up doing is adding --root-path . so that it tries to the current folder then it works just fine. I'll move that folder to where it is supposed to go and it doesn't give any fits moving either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants