3

I'm tinkering with adding Python functionality to LaTeX, and I prefer to use Eclipse as my editor. I have tried a simple code:


\documentclass{article}

\usepackage{python}

\begin{document}   

\begin{python}
print 'Hello World'
\end{python}

\end{document}

I get the following error:

running: /usr/texbin/pdflatex -synctex=1 -interaction=nonstopmode --src-specials document.tex 
pdflatex> This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
pdflatex>  restricted \write18 enabled.
pdflatex>  Source specials enabled.
pdflatex> entering extended mode
pdflatex> (./document.tex
pdflatex> LaTeX2e 
pdflatex> Babel  and hyphenation patterns for 79 languages loaded.
pdflatex> (/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
pdflatex> Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
pdflatex> (/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo))
pdflatex> (/usr/local/texlive/2015/texmf-dist/tex/latex/python/python.sty)
pdflatex> (./document.aux)
pdflatex> ! I can't find file `document.py.out'.
pdflatex>  
pdflatex>                    \def 
pdflatex> l.14 \end{python}
pdflatex>                  
pdflatex> (Press Enter to retry, or Control-D to exit)
pdflatex> Please type another input file name
pdflatex> ! Emergency stop.
pdflatex>  
pdflatex>                    \def 
pdflatex> l.14 \end{python}
pdflatex>                  
pdflatex> !  ==> Fatal error occurred, no output PDF file produced!
pdflatex> Transcript written on document.log.

I am running Mac OSX 10.10.5. It seems like I should be adding some parameters to the builder but I'm not sure what. Thanks in advance for the assistance.

  • 2
    restricted \write18 won't allow it to run python, add --shell-escape flag on the pdflatex command line, – David Carlisle Oct 3 '15 at 18:48
  • I replaced the parameters in the builder with that but it didn't work. However, putting that flag ahead of the parameters in the builder has worked! Hopefully this helps someone else in the future. – user3666782 Oct 3 '15 at 20:39
  • I'd recommend having a look at the pythontex package. – Torbjørn T. Feb 9 '17 at 11:55
3

See exchange above. Adding --shell-escape ahead of the arguments in the menu Eclipse>Preferences>Texlipse>Builder Settings worked out. Thx to David Carlisle

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.