Bug 2379729

Summary: texlive-pythontex is not compatible with python3.13
Product: [Fedora] Fedora Reporter: Paul DeStefano <prd-fedora>
Component: texlive-baseAssignee: Than Ngo <than>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 42CC: caznaranl, spotrh, than
Target Milestone: ---Keywords: Desktop
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: texlive-base-20230311-91.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-07-21 09:58:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
fix issue with python3.13 none

Description Paul DeStefano 2025-07-12 20:22:56 UTC
upstream report: https://github.com/gpoore/pythontex/issues/220

patch is available, but not accepted.

Reproducible: Always

Steps to Reproduce:
1. add \usepackage{pythontex} to any .tex document
2. build

Actual Results:
syntax error for \s... in docstring in `../python3.py` file part of RPM package.

Expected Results:
no error

Comment 1 Than Ngo 2025-07-15 13:06:36 UTC
I have created following small test and built it without any error on latest f42 with python3-3.13.5-1.fc42:

\documentclass{article}
\usepackage{pythontex}
\begin{document}
\section*{test for pythontex}
It's test for pythontex rhbz\#2379729
\end{document}


Running pythontex --version only shows the warning but not the error!

Could you please provide more infos to reproduce your problem?

Thank you!

Comment 2 Paul DeStefano 2025-07-15 22:05:17 UTC
Sorry.  You have to put some pycode, too.  I short changed you on the procedure.

$ cat try1.tex
\documentclass{article}
\usepackage{pythontex}
\begin{pycode}
n = 1;
\end{pycode}
\begin{document}
\section*{test for pythontex}
It's test for pythontex rhbz\#2379729
\end{document}


$ latexmk try1.tex
...
------------          
Run number 1 of rule 'pythontex'                                                                   
------------                                     
------------          
Running 'pythontex  "try2.pytxcode"'                                                               
------------                                     
/usr/share/texlive/texmf-dist/scripts/pythontex/pythontex3.py:557: SyntaxWarning: invalid escape sequence '\s'
  the "\\usepackage{pythontex}":  "\setpythontexworkingdir{<outputdir>}".
  the "\\usepackage{pythontex}":  "\setpythontexworkingdir{<outputdir>}".
/usr/share/texlive/texmf-dist/scripts/pythontex/pythontex3.py:1810: SyntaxWarning: invalid escape sequence '\s'
  errgobble = match('(\s*)', line).groups()[0]
/usr/share/texlive/texmf-dist/scripts/pythontex/pythontex3.py:2075: SyntaxWarning: invalid escape sequence '\s'
  errgobble = match('(\s*)', line).groups()[0]
This is PythonTeX 0.18

----  Messages for py:default:default  ----                                                        
  /usr/share/texlive/texmf-dist/scripts/pythontex/pythontex_utils.py:239: SyntaxWarning: invalid escape sequence '\m'


Did you see the upstream issue?

Comment 3 Than Ngo 2025-07-16 11:50:34 UTC
Created attachment 2097384 [details]
fix issue with python3.13

I did a local scratch build of texlve-base with a fix for this issue and attached texlive-pythontex-svn59514-90.fc42.noarch.rpm for testing.

Could you please download and test?

Thank you!

Comment 4 Paul DeStefano 2025-07-16 15:57:19 UTC
Great!  Thanks for doing that.  I'm happy to test, but it says I'm not authorized to access the attachment in Comment 3.  Says it is "private".  I'm not a maintainer, just a long time fedora user.  Could you send it to my e-mail or make it not private?  If you want to send encrypted or something, I have protonmail or I can send you GPG key.

Comment 5 Paul DeStefano 2025-07-16 16:12:48 UTC
Got it!

Comment 6 Than Ngo 2025-07-17 07:41:44 UTC
Hi Paul,

it would be great if you could please report some feedbacks.
Thanks

Comment 7 Paul DeStefano 2025-07-18 07:12:47 UTC
Sorry yet again.  The new RPM worked great.

It immediately eliminated the errors I reported.  However, I had some problems with latexmk and couldn't figure it out before I had to run some errands.  But, I did get it to work.  Apparently, latexmk didn't like having the pycode environment immediately before \begin{document}.  I inserted an empty line, in between, and it seems to work fine.  Odd, though, pdflatex didn't have a problem.  Confusing, but that's why I didn't get back to you sooner, but everything is fine, as best I can tell.

Thank you VERY MUCH for this amazingly quick fix.

Comment 8 Fedora Update System 2025-07-21 08:56:32 UTC
FEDORA-2025-fb96875f6d (texlive-base-20230311-91.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-fb96875f6d

Comment 9 Fedora Update System 2025-07-21 09:58:32 UTC
FEDORA-2025-fb96875f6d (texlive-base-20230311-91.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.