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

"SyntaxWarning: invalid escape sequence \(" #23

Closed
hellishvictor opened this issue Jul 13, 2024 · 2 comments
Closed

"SyntaxWarning: invalid escape sequence \(" #23

hellishvictor opened this issue Jul 13, 2024 · 2 comments

Comments

@hellishvictor
Copy link

Hi, on Python v3.12 it shows the error:

SyntaxWarning: invalid escape sequence '\(
SyntaxWarning: invalid escape sequence '\)

On v3.12 changed the meaning of the regular expressions, and in places where was used \. now is only ..
So "\Python\Lib\site-packages\pydub\utils.py" must be corrected from line 299:

    for token in extra_info[stream['index']]:
        m = re.match('([su]([0-9]{1,2})p?) (([0-9]{1,2}) bit)$', token)
        m2 = re.match('([su]([0-9]{1,2})p?)( (default))?$', token)
        if m:
            set_property(stream, 'sample_fmt', m.group(1))
            set_property(stream, 'bits_per_sample', int(m.group(2)))
            set_property(stream, 'bits_per_raw_sample', int(m.group(3)))
        elif m2:
            set_property(stream, 'sample_fmt', m2.group(1))
            set_property(stream, 'bits_per_sample', int(m2.group(2)))
            set_property(stream, 'bits_per_raw_sample', int(m2.group(2)))
        elif re.match('(flt)p?( (default))?$', token):
            set_property(stream, 'sample_fmt', token)
            set_property(stream, 'bits_per_sample', 32)
            set_property(stream, 'bits_per_raw_sample', 32)
        elif re.match('(dbl)p?( (default))?$', token):
            set_property(stream, 'sample_fmt', token)
            set_property(stream, 'bits_per_sample', 64)
            set_property(stream, 'bits_per_raw_sample', 64)
    return info

Cheers.

@woodruffw
Copy link
Owner

That's in a dependency. Could you file that with pydub instead? I don't have any ability to fix it here.

@woodruffw woodruffw closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2024
@hellishvictor
Copy link
Author

Done, thank you for point me that out.

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

No branches or pull requests

2 participants