pdflatex - 将 latex 转换为 pdf 时有时会出错

pdflatex - 将 latex 转换为 pdf 时有时会出错

我正在使用pdflatexUbuntu将 latex 文件转换为 pdf 文件。

我正在随机生成的 UUID 路径上转换同一个文件,如下所示:

/tmp/crawler-downloads/fc2071e4-63f7-4c12-b750-9ea21cd103fe/sample.tex

在python中的用法:

process = Popen(['pdftex',
                     '--output-directory',
                     os.path.dirname(input_file_path),
                     '-interaction',
                     'nonstopmode',
                     input_file_path],
                    stdout=PIPE,
                    stderr=PIPE)
process.communicate(timeout=90)

在命令行上运行此行:

pdftex -interaction nonstopmode sample.tex

有时转换成功,有时转换失败。

在生成的日志文件中我可以看到这个错误:

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.8.2)  2 AUG 2017 13:32
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**/tmp/crawler-downloads/3692ac8d-6a43-4164-ad30-49ef0c857c62/source.tex
(/tmp/crawler-downloads/3692ac8d-6a43-4164-ad30-49ef0c857c62/source.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
Package: amssymb 2013/01/14 v3.01 AMS font symbols

(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\@emptytoks=\toks14
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
))
(/usr/share/texlive/texmf-dist/tex/latex/base/latexsym.sty
Package: latexsym 1998/08/17 v2.2e Standard LaTeX package (lasy symbols)
\symlasy=\mathgroup6
LaTeX Font Info:    Overwriting symbol font `lasy' in version `bold'
(Font)                  U/lasy/m/n --> U/lasy/b/n on input line 52.
)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
Package: amsmath 2016/03/03 v2.15a AMS math features
\@mathmargin=\skip43

For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
Package: amstext 2000/06/29 v2.01 AMS text

(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks15
\ex@=\dimen103
))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen104
)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty
Package: amsopn 1999/12/14 v2.01 operator names
)
\inf@bad=\count87
LaTeX Info: Redefining \frac on input line 199.
\uproot@=\count88
\leftroot@=\count89
LaTeX Info: Redefining \overline on input line 297.
\classnum@=\count90
\DOTSCASE@=\count91
LaTeX Info: Redefining \ldots on input line 394.
LaTeX Info: Redefining \dots on input line 397.
LaTeX Info: Redefining \cdots on input line 518.
\Mathstrutbox@=\box26
\strutbox@=\box27
\big@size=\dimen105
LaTeX Font Info:    Redeclaring font encoding OML on input line 630.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 631.
\macc@depth=\count92
\c@MaxMatrixCols=\count93
\dotsspace@=\muskip10
\c@parentequation=\count94
\dspbrk@lvl=\count95
\tag@help=\toks16
\row@=\count96
\column@=\count97
\maxfields@=\count98
\andhelp@=\toks17
\eqnshift@=\dimen106
\alignsep@=\dimen107
\tagshift@=\dimen108
\tagwidth@=\dimen109
\totwidth@=\dimen110
\lineht@=\dimen111
\@envbody=\toks18
\multlinegap=\skip44
\multlinetaggap=\skip45
\mathdisplay@stack=\toks19
LaTeX Info: Redefining \[ on input line 2735.
LaTeX Info: Redefining \] on input line 2736.
)
\c@theorem=\count99

No file source.aux.
\openout1 = `source.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 29.
LaTeX Font Info:    ... okay on input line 29.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 29.
LaTeX Font Info:    ... okay on input line 29.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 29.
LaTeX Font Info:    ... okay on input line 29.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 29.
LaTeX Font Info:    ... okay on input line 29.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 29.
LaTeX Font Info:    ... okay on input line 29.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 29.
LaTeX Font Info:    ... okay on input line 29.
LaTeX Font Info:    Try loading font information for U+msa on input line 33.
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info:    Try loading font information for U+msb on input line 33.

(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
LaTeX Font Info:    Try loading font information for U+lasy on input line 33.

(/usr/share/texlive/texmf-dist/tex/latex/base/ulasy.fd
File: ulasy.fd 1998/08/17 v2.2e LaTeX symbol font definitions
)

Package amsmath Warning: Foreign command \atopwithdelims;
(amsmath)                \frac or \genfrac should be used instead
(amsmath)                 on input line 62.

[1

{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2]
(/tmp/crawler-downloads/3692ac8d-6a43-4164-ad30-49ef0c857c62/source.aux) ) 
Here is how much of TeX's memory you used:
 1194 strings out of 494953
 13827 string characters out of 6180978
 63239 words of memory out of 5000000
 4497 multiletter control sequences out of 15000+600000
 16702 words of font info for 69 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 27i,6n,26p,517b,189s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr
/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share
/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texli
ve/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx9.pfb></usr/share/texlive/texm
f-dist/fonts/type1/public/amsfonts/cm/cmcsc10.pfb></usr/share/texlive/texmf-dis
t/fonts/type1/public/amsfonts/cm/cmex10.pfb></usr/share/texlive/texmf-dist/font
s/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texlive/texmf-dist/fonts/type
1/public/amsfonts/cm/cmmi7.pfb></usr/share/texlive/texmf-dist/fonts/type1/publi
c/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfo
nts/cm/cmr12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/
cmr17.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr5.pf
b></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/
share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></usr/share/te
xlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmss10.pfb></usr/share/texlive/texmf-di
st/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fon
ts/type1/public/amsfonts/cm/cmsy7.pfb></usr/share/texlive/texmf-dist/fonts/type
1/public/amsfonts/cm/cmti10.pfb></usr/share/texlive/texmf-dist/fonts/type1/publ
ic/amsfonts/latxfont/lasy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/publ
ic/amsfonts/latxfont/lcircle1.pfb></usr/share/texlive/texmf-dist/fonts/type1/pu
blic/amsfonts/latxfont/line10.pfb>
!pdfTeX error: pdflatex: getcwd() failed (No such file or directory), path too 
long?
 ==> Fatal error occurred, no output PDF file produced!

日志的末尾写道:

    !pdfTeX error: pdflatex: getcwd() failed (No such file or directory), path too 
long?
 ==> Fatal error occurred, no output PDF file produced!

问题真的是路径太长吗?我觉得很奇怪,它无法处理这个问题。

有没有其他解决方案可以修复它而不改变文件路径?

相关内容