PythonTeX로 간단한 예제를 실행하면 실패합니다.

PythonTeX로 간단한 예제를 실행하면 실패합니다.

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() 유니코드 입력을 지원하지 않았습니다.Python 2.7.3 이전.

2013년 8월 27일 수정:PythonTeX v0.12는 2.7.3 이전의 Python 버전을 감지하고 문제를 해결합니다.

관련 정보