
PythonTeX の v 0.12 ベータ版を使用して、次の例をコンパイルしようとしています。
\documentclass[12pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pythontex}
\begin{document}
\py{2+2}
\end{document}
ファイルを実行pdflatex
すると、pythontex
次のエラーが発生します。
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:
これはベータ版のバグでしょうか、それとも私が何か間違っているのでしょうか?
編集:最初の6行
の最初の 6 行は次のとおりですpythntx1.pytxcode
。
=>PYTHONTEX#py#default#default#0#i####8#
2+2
=>PYTHONTEX:SETTINGS#
version=v0.12beta
outputdir=pythontex-files-pythntx1
workingdir=pythontex-files-pythntx1
コードを実行すると、別のエラーが発生します。
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
編集 20130716:
969行目のカンマを修正すると、
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
編集 20130716:
Python 2.7.5 にアップグレードすると、次のようになります:
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
答え1
PythonTeX v0.12beta は Python 2.7.3 以降では動作しますが、Python 2.7.2 以前では動作しません。これは 2.7.3 で導入された変更によるものです。最終的な 0.12 リリースが Python 2.7 のすべてのバージョンで動作するように努めます。
私はPython 2.7.2で少し実験を行い、問題の根本的な原因を突き止めました。 subprocess.Popen()
問題はそれではありませんでした。むしろ、shlex.split()
Unicode入力をサポートしていなかったPython 2.7.3 より前。
編集 2013/08/27:PythonTeX v0.12 は Python 2.7.3 より前のバージョンを検出し、問題を回避します。