incomplete escape \U at position 3 #38

Open
opened 2023-10-27 02:16:19 -04:00 by kenny070287 · 6 comments
kenny070287 commented 2023-10-27 02:16:19 -04:00 (Migrated from github.com)

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
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 commented 2023-11-17 04:14:26 -05:00 (Migrated from github.com)

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

I am facing the same problem. I tried removing those failed entries from .song_ids and .song_archive but no luck.
ray2301 commented 2023-12-03 16:42:51 -05:00 (Migrated from github.com)

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.

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 commented 2023-12-05 13:41:06 -05:00 (Migrated from github.com)

same issue here with

same issue here with
shinji257 commented 2023-12-21 15:09:43 -05:00 (Migrated from github.com)

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.

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.
LylianProgrammer commented 2024-12-14 10:25:25 -05:00 (Migrated from github.com)

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

Bro thank you so much, this did it for me!

> 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` Bro thank you so much, this did it for me!
kenny070287 commented 2024-12-18 10:10:29 -05:00 (Migrated from github.com)

https://github.com/zotify-dev/zotify/blob/main/INSTALLATION.md

i used Scoop to install zotify based on this link, how do i find the track.py? thanks!

https://github.com/zotify-dev/zotify/blob/main/INSTALLATION.md i used Scoop to install zotify based on this link, how do i find the `track.py`? thanks!
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zotify-dev/zotify#38
No description provided.