8000 Invalid escape sequences in python3.py · Issue #220 · gpoore/pythontex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Invalid escape sequences in python3.py #220

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

Open
AndrewSwann opened this issue Jan 15, 2024 · 3 comments
Open

Invalid escape sequences in python3.py #220

AndrewSwann opened this issue Jan 15, 2024 · 3 comments

Comments

@AndrewSwann
Copy link

When compiling a file with pythontex I get messages about invalid escape sequences in python3.py. I am running the latest version from texlive. The output of pythontex --version gives

/usr/local/texlive/2023/texmf-dist/scripts/pythontex/pythontex3.py:549: SyntaxWarning: invalid escape sequence '\s'
  msg = '''
/usr/local/texlive/2023/texmf-dist/scripts/pythontex/pythontex3.py:1810: SyntaxWarning: invalid escape sequence '\s'
  errgobble = match('(\s*)', line).groups()[0]
/usr/local/texlive/2023/texmf-dist/scripts/pythontex/pythontex3.py:2075: SyntaxWarning: invalid escape sequence '\s'
  errgobble = match('(\s*)', line).groups()[0]
PythonTeX 0.18

which already contains the errors.

The first instance should replace "\setpythontexworkingdir{<outputdir>}". by "\\setpythontexworkingdir{<outputdir>}". in the subsequent string.
The other two cases should probably replace '(\s*)' by a raw string r'(\s*)'.

I don't have experience of making changes on github, and have not be able to run pythontex in a way that uses a modified local version of python3.py, so have not be able to test these changes.

@eg9
Copy link
eg9 commented Aug 4, 2024

I can confirm the issue, but I also get another interesting bit.

/usr/local/texlive/2024/texmf-dist/scripts/pythontex/pythontex3.py:549: SyntaxWarning: invalid escape sequence '\s'
  msg = '''
/usr/local/texlive/2024/texmf-dist/scripts/pythontex/pythontex3.py:1810: SyntaxWarning: invalid escape sequence '\s'
  errgobble = match('(\s*)', line).groups()[0]
/usr/local/texlive/2024/texmf-dist/scripts/pythontex/pythontex3.py:2075: SyntaxWarning: invalid escape sequence '\s'
  errgobble = match('(\s*)', line).groups()[0]
Traceback (most recent call last):
  File "/Library/TeX/texbin/pythontex", line 55, in <module>
    import pythontex3 as pythontex
  File "/usr/local/texlive/2024/texmf-dist/scripts/pythontex/pythontex3.py", line 61, in <module>
    from pygments.styles import get_all_styles
ModuleNotFoundError: No module named 'pygments'

@Reissner
Copy link
Contributor

made a pull request. Seems as if some prefix r missing.

@Reissner
Copy link
Contributor

By the way, seems to be a problem only from 3.12 or that like on.

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

3 participants
0