The compilation works fine if I use LaTeX, Python, and then LaTeX, with the command for Python :
python "C:\Program Files (x86)\MiKTeX 2.9\scripts\pythontex\pythontex.py"
But I can't use latexmk to make the same thing :
If I try:
latexmk -r C:\latexmk\LatexMk.txt essai.tex
with in the file LatexMk.txt:
add_cus_dep('pytxcode', 'tex', 0, 'pythontex');
sub pythontex { return system("pythontex \"$_[0]\""); }
$aux_dir = 'auxiliaire2';
$pdflatex = 'pdflatex-synctex=1 --shell-escape %O %S';
$latex = 'latex -synctex=1 --shell-escape %O %S';
then LaTeX compiles fine, but when PythonTeX runs, an arror occurs:
Package PythonTeX Warning: Non-existent Pygments content on input line 11.
and I obtain as result
??PythonTex??
I don't understand why. I'm using Windows 10.
More precisely, essai.tex is:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pythontex}
\begin{document}
Here's the code in the document
\begin{pyverbatim}
return '\\SI{' + str(var) + '}{' + unit + '}'
\end{pyverbatim}
\end{document}
and the console's ouput is :
'Custom dependency list:
pytxcode tex 0 pythontex
Latexmk: This is Latexmk, John Collins, 17 Jan. 2018, version: 4.55.
Rule 'latex': File changes, etc:
Changed files, or newly in use since previous run(s):
'E:\professionnel\_BTS_SIO_1_U_22_algo\TD_6\essai.tex'
'essai.tex'
------------
Run number 1 of rule 'latex'
------------
------------
Running 'latex -synctex=1 --shell-escape -recorder -aux-
directory="auxiliaire2"
"E:\professionnel\_BTS_SIO_1_U_22_algo\TD_6\essai.tex"'
------------
Latexmk: applying rule 'latex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6630 64-bit)
entering extended mode
(E:/professionnel/_BTS_SIO_1_U_22_algo/TD_6/essai.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 75 language(s) loaded.
Comment from me : I cut lines where Miktex works...
No file pythontex-files-essai/essai.pytxmcr.
Run PythonTeX to create it.
Package PythonTeX Warning: Non-existent Pygments content on input line 11.
[1] (E:\professionnel\_BTS_SIO_1_U_22_algo\TD_6\auxiliaire2\essai.aux) )
Output written on essai.dvi (1 page, 480 bytes).
SyncTeX written on essai.synctex.gz.
Transcript written on
E:\professionnel\_BTS_SIO_1_U_22_algo\TD_6\auxiliaire2\es
sai.log.
===========Latexmk: Missing input file: 'pythontex-files-
essai/essai.pytxmcr' from line 'No file pythontex-files-essai/essai.pytxmcr.' Latexmk: Missing input file: 'pythontex-files-essai/essai.pytxmcr' from line 'No file pythontex-files-essai/essai.pytxmcr.' Latexmk: Log file says output to 'essai.dvi' === TeX engine is 'pdfTeX' Latexmk: All targets (essai.dvi) are up-to-date'

add_cus_dep('pytxcode', 'tex', 0, 'pytxcode2tex'); sub pytxcode2tex { return system("pythontex \"$_[0]\""); }I have no problem. Note: there is an added space between thepythontexand the\"in the rule. – Herb Schulz Mar 17 '18 at 20:27