vallettaventures/TexpadKB

PythonTeX Buildscript

mia1024 opened this issue · 6 comments

Hi,

I created a buildscript (attached) to create PythonTeX files. However, the script doesn't seem to be working. The output of test.tex is four question marks. I checked the output and it seems that the second line of my buildscript is skipped for some reason. Can you please tell me why? Below is the output accessed via 'issue' in Texpad. I really like Texpad. Thank you very much!

/bin/bash ~/Library/Application Support/Texpad/BuildScripts/PythonTeX.tpbuild

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(~/Desktop/LaTeX/Class Notes/test/test.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2016/texmf-dist/tex/latex/pythontex/pythontex.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/fvextra/fvextra.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix <2008/02/07> (tvz) (/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)) (/usr/local/texlive/2016/texmf-dist/tex/latex/upquote/upquote.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/lineno/lineno.sty)) (/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.tex)) (/usr/local/texlive/2016/texmf-dist/tex/latex/pgfopts/pgfopts.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)))) (/usr/local/texlive/2016/texmf-dist/tex/latex/caption/newfloat.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/currfile/currfile.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty) (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))) (/usr/local/texlive/2016/texmf-dist/tex/latex/filehook/filehook.sty))) (/usr/local/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2016/texmf-dist/tex/latex/pdftex-def/pdftex.def))
No file test.aux.
No file pythontex-files-test/test.pytxmcr.
Run PythonTeX to create it.
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)

Package PythonTeX Warning: Non-existent Pygments content on input line 4.


Package PythonTeX Warning: Missing autoprint content on input line 5.

[1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) )</usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 17073 bytes).
Transcript written on test.log.
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(~/Desktop/LaTeX/Class Notes/test/test.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2016/texmf-dist/tex/latex/pythontex/pythontex.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/fvextra/fvextra.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix <2008/02/07> (tvz) (/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)) (/usr/local/texlive/2016/texmf-dist/tex/latex/upquote/upquote.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/lineno/lineno.sty)) (/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.tex)) (/usr/local/texlive/2016/texmf-dist/tex/latex/pgfopts/pgfopts.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)))) (/usr/local/texlive/2016/texmf-dist/tex/latex/caption/newfloat.sty) (/usr/local/texlive/2016/texmf-dist/tex/latex/currfile/currfile.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty) (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))) (/usr/local/texlive/2016/texmf-dist/tex/latex/filehook/filehook.sty))) (/usr/local/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2016/texmf-dist/tex/latex/pdftex-def/pdftex.def)) (./test.aux)
No file pythontex-files-test/test.pytxmcr.
Run PythonTeX to create it.
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)

Package PythonTeX Warning: Non-existent Pygments content on input line 4.


Package PythonTeX Warning: Missing autoprint content on input line 5.

[1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) )</usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 17073 bytes).
Transcript written on test.log.

Content of my script:

pdflatex "$TEXPAD_ROOTFILE"
pythontex "$TEXPAD_ROOTFILE"
pdflatex "$TEXPAD_ROOTFILE"

Content of my test.tex:

\documentclass{article}
\usepackage{pythontex}
\begin{document}
\pygment{python}{print('Hello PythonTeX')}\\
\py{2**20}
\end{document}

Hi, did you find a solution finally ?

I'm not able to create a PythonTeX Buildscript for TexPad and XeLatex.

An example has been uploaded to https://github.com/vallettaventures/TexpadKB/blob/master/tpbuild-scripts/PythonTeX.tpbuild . This is a simple example that uses pdflatex only. Please adjust to your more complex needs if necessary (such as `xelatex, bibliographies, indices, etc.).

Hie there,
I added your script in the directory
And yet, this example does not work:

`\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{pythontex}

\begin{document}
Nous avons $1+2\times 10=$ \py{1+2*10}
\end{document}`

Would you be so kind to help me on this ?
Thanks a lot

Hie there,
I added your script in the directory
And yet, this example does not work:

`\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{pythontex}

\begin{document}
Nous avons $1+2\times 10=$ \py{1+2*10}
\end{document}`

Would you be so kind to help me on this ?
Thanks a lot

Hi,

Which kind of error ? A pdf is generated ?

The problem in these cases is that generally there has been some environment setup in the shell's profile for python to work. The issue is that the .bash_profile, .zsh_profile etc does not apply to Texpad, as it gets launched from launchd.

There are two options to solve this

  • setup the environment in launchd, but this is harder with recent versions of macOS that have restricted this for security
  • source the profile file at the top of the tpbuild script, this imports any environment setup into that script and python will work the same when called from Texpad as it will in your terminal.