Skip to content

Python 3.12.3: SyntaxWarning: invalid escape sequence '\s' #1978

@kutlay

Description

@kutlay

I'm getting the following trace while trying to use GitPython on Python 3.12.3:

/home/airflow/.local/lib/python3.12/site-packages/git/config.py:123: SyntaxWarning: invalid escape sequence '\s'
  re_comment = re.compile('^\s*[#;]')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/airflow/.local/lib/python3.12/site-packages/git/__init__.py", line 33, in <module>
    from git.config import GitConfigParser
  File "/home/airflow/.local/lib/python3.12/site-packages/git/config.py", line 186
    except IOError,e:
           ^^^^^^^^^

I believe this is due to the change in Python 3.12: https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes

Similar issues were reported here:
HandBrake/HandBrake#5454
cs-pub-ro/operating-systems#107

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions