LaTeXTools icon indicating copy to clipboard operation
LaTeXTools copied to clipboard

Using tex-option=-shell-escape different behaviour from command line and from Sublime Text on Windows with LaTeX python-package

Open saikon opened this issue 11 years ago • 2 comments

I am trying to get Python-scripts to run from inside my LaTeX documents. I am using Windows and MikTeX with texify.

I modified the traditionalBuilder.py a bit to see which command it executes and to use the same command from the command line manually. I replaced this line:

yield (cmd + [self.tex_name], "Invoking " + cmd[0] + "... ")

With this:

yield (cmd + [self.tex_name], "Invoking " + ' '.join(cmd + [self.tex_name]) + "... ")

The tex-file in question contains this:

\documentclass{article}
\usepackage{python}

\begin{document}

Say hello Python:
\begin{python}%
print(r"Hello \LaTeX!")
\end{python}%

\end{document}

The command used by LaTeXTools to build that file is: texify -b -p --tex-option="--shell-escape" --tex-option="--synctex=1" pythontest2.tex LaTeXTools gives out an error I can't find file pythontest2.py.out'. [\end{python}]`.

The same file compiles just fine when using the same command from command line. It creates the missing pythontest2.py.out file and creates the PDF-just fine.

The -shell-escape option seems to work otherwise fine. Since the below LaTeX-file creates the list.txt just fine when using -shell-escape.

\documentclass{article}
\begin{document}
-shell-escape
\immediate\write18{dir > list.txt}
\end{document}

saikon avatar Oct 19 '14 14:10 saikon