
Mit der Betaversion 0.12 von PythonTeX versuche ich, das folgende Beispiel zu kompilieren:
\documentclass[12pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pythontex}
\begin{document}
\py{2+2}
\end{document}
Ich führe pdflatex
die Datei aus. Beim Ausführen pythontex
der Datei erhalte ich den folgenden Fehler:
C:\Users\Uwe\Documents\python\Scripts\pythontex>pythontex pythntx1
This is PythonTeX v0.12beta
Traceback (most recent call last):
File "c:/texlive/2013/texmf-dist/scripts/pythontex/pythontex.py", line 48, in
<module>
pythontex.main()
File "c:\texlive\2013\texmf-dist\scripts\pythontex\pythontex2.py", line 2125,
in main
do_multiprocessing(data, temp_data, old_data, engine_dict)
File "c:\texlive\2013\texmf-dist\scripts\pythontex\pythontex2.py", line 1055,
in do_multiprocessing
result = task.get()
File "C:\Python27\lib\multiprocessing\pool.py", line 522, in get
raise self._value
TypeError: must be string without null bytes or None, not str
C:\texlive\2013\bin\win32\runscript.tlu:596: command failed with exit code 1:
Ist das ein Fehler in der Beta oder mache ich etwas falsch?
EDIT: Die ersten sechs Zeilen der
Hier sind die ersten sechs Zeilen von pythntx1.pytxcode
:
=>PYTHONTEX#py#default#default#0#i####8#
2+2
=>PYTHONTEX:SETTINGS#
version=v0.12beta
outputdir=pythontex-files-pythntx1
workingdir=pythontex-files-pythntx1
Wenn Sie den Code jetzt ausführen, tritt ein anderer Fehler auf:
C:\Users\Uwe\Documents\python\Scripts\pythontex>pdflatex pythntx1.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/W32TeX)
restricted \write18 enabled.
entering extended mode
(./pythntx1.tex
LaTeX2e <2011/06/27>
Babel <3.9f> and hyphenation patterns for 78 languages loaded.
(c:/texlive/2013/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2012/07/29 v3.11b KOMA-Script document class (article)
(c:/texlive/2013/texmf-dist/tex/latex/koma-script/scrkbase.sty
(c:/texlive/2013/texmf-dist/tex/latex/koma-script/scrbase.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/keyval.sty)
(c:/texlive/2013/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2012/06/15 v3.12 KOMA-Script package (loading files)
Copyright (C) Markus Kohm
))) (c:/texlive/2013/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(c:/texlive/2013/texmf-dist/tex/latex/koma-script/scrsize12pt.clo)
(c:/texlive/2013/texmf-dist/tex/latex/koma-script/typearea.sty
Package typearea, 2012/07/29 v3.11b KOMA-Script package (type area)
Copyright (C) Frank Neukam, 1992-1994
Copyright (C) Markus Kohm, 1994-
)) (c:/texlive/2013/texmf-dist/tex/latex/base/fontenc.sty
(c:/texlive/2013/texmf-dist/tex/latex/base/t1enc.def))
(c:/texlive/2013/texmf-dist/tex/latex/base/inputenc.sty
(c:/texlive/2013/texmf-dist/tex/latex/base/utf8.def
(c:/texlive/2013/texmf-dist/tex/latex/base/t1enc.dfu)
(c:/texlive/2013/texmf-dist/tex/latex/base/ot1enc.dfu)
(c:/texlive/2013/texmf-dist/tex/latex/base/omsenc.dfu)))
(c:/texlive/2013/texmf-dist/tex/latex/pythontex/pythontex.sty
(c:/texlive/2013/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)) (c:/texlive/2013/texmf-dist/tex/latex/etex-pkg/etex.sty)
(c:/texlive/2013/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(c:/texlive/2013/texmf-dist/tex/generic/xstring/xstring.sty
(c:/texlive/2013/texmf-dist/tex/generic/xstring/xstring.tex))
(c:/texlive/2013/texmf-dist/tex/latex/pgfopts/pgfopts.sty
(c:/texlive/2013/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(c:/texlive/2013/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)
))) (c:/texlive/2013/texmf-dist/tex/latex/caption/newfloat.sty)
(c:/texlive/2013/texmf-dist/tex/latex/upquote/upquote.sty
(c:/texlive/2013/texmf-dist/tex/latex/base/textcomp.sty
(c:/texlive/2013/texmf-dist/tex/latex/base/ts1enc.def
(c:/texlive/2013/texmf-dist/tex/latex/base/ts1enc.dfu))))) (./pythntx1.aux)
(c:/texlive/2013/texmf-dist/tex/latex/base/ts1cmr.fd)
(c:/texlive/2013/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2013/texmf-dist/tex/latex/latexconfig/color.cfg)
(c:/texlive/2013/texmf-dist/tex/latex/pdftex-def/pdftex.def
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(c:/texlive/2013/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)))
Package PythonTeX Warning: Missing autoprint content on input line 8.
[1{c:/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./pythntx1.aux) ){c:/texlive/2013/texmf-dist/fonts/enc/dvips/cm-super/cm-super
-t1.enc}<c:/texlive/2013/texmf-dist/fonts/type1/public/cm-super/sfbx1200.pfb><c
:/texlive/2013/texmf-dist/fonts/type1/public/cm-super/sfrm1200.pfb>
Output written on pythntx1.pdf (1 page, 4786 bytes).
Transcript written on pythntx1.log.
C:\Users\Uwe\Documents\python\Scripts\pythontex>pythontex pythntx1
Traceback (most recent call last):
File "c:/texlive/2013/texmf-dist/scripts/pythontex/pythontex.py", line 41, in
<module>
import pythontex2 as pythontex
File "c:\texlive\2013\texmf-dist\scripts\pythontex\pythontex2.py", line 970
engine_dict[input_family].extension,
^
SyntaxError: invalid syntax
C:\texlive\2013\bin\win32\runscript.tlu:596: command failed with exit code 1:
python.exe c:/texlive/2013/texmf-dist/scripts/pythontex/pythontex.py pythntx1
BEARBEITEN 20130716:
Nach dem Korrigieren des Kommas in Zeile 969 erhalte ich
C:\Users\Uwe\Documents\python\Scripts\pythontex>pythontex pythntx1
This is PythonTeX v0.12beta
Traceback (most recent call last):
File "c:/texlive/2013/texmf-dist/scripts/pythontex/pythontex.py", line 48, in
<module>
pythontex.main()
File "c:\texlive\2013\texmf-dist\scripts\pythontex\pythontex2.py", line 2125,
in main
do_multiprocessing(data, temp_data, old_data, engine_dict)
File "c:\texlive\2013\texmf-dist\scripts\pythontex\pythontex2.py", line 976, i
n do_multiprocessing
keeptemps, hashdependencies)
File "c:\texlive\2013\texmf-dist\scripts\pythontex\pythontex2.py", line 1203,
in run_code
proc = subprocess.Popen(exec_cmd, stdout=out_file, stderr=err_file)
File "C:\Python27\lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 893, in _execute_child
startupinfo)
TypeError: must be string without null bytes or None, not str
C:\texlive\2013\bin\win32\runscript.tlu:596: command failed with exit code 1:
python.exe c:/texlive/2013/texmf-dist/scripts/pythontex/pythontex.py pythntx1
BEARBEITEN 20130716:
Nach dem Upgrade auf Python 2.7.5 erhalte ich jetzt:
Upgraded to Python 2.7.5. The old error is gone, but_
pythontex pythntx1
This is PythonTeX v0.12beta
---- Messages for py:default:default ----
* PythonTeX notice
1 message(s) could not be classified
Based on the return code, they were interpreted as errors
* PythonTeX stderr - unknown on line ??:
python: can't open file '<outputdir>\py_default_default.py': [Errno 2] No such
file or directory
--------------------------------------------------
PythonTeX: pythntx1 - 1 error(s), 0 warning(s)
C:\texlive\2013\bin\win32\runscript.tlu:596: command failed with exit code 1:
python.exe c:/texlive/2013/texmf-dist/scripts/pythontex/pythontex.py pythntx1
Antwort1
PythonTeX v0.12beta funktioniert mit Python 2.7.3 und höher, aber nicht mit Python 2.7.2 und früher. Dies liegt an den in 2.7.3 eingeführten Änderungen. Ich werde versuchen, die endgültige Version 0.12 mit allen Versionen von Python 2.7 kompatibel zu machen.
Ich habe ein wenig mit Python 2.7.2 experimentiert und die eigentliche Ursache des Problems gefunden. subprocess.Popen()
war nicht das Problem. Vielmehrshlex.split()
unterstützte keine Unicode-Eingabevor Python 2.7.3.
Bearbeitung 27.08.2013:PythonTeX v0.12 erkennt Python-Versionen vor 2.7.3 und umgeht das Problem.