繁体   English   中英

如何使用 Python 修复 Pyx 模块中的回溯错误?

[英]How to fix traceback error in Pyx module with Python?

我正在尝试在 Python 中的 PyX 模块中运行。

这是一个名为“mplot.py”的简单程序:

 from pyx import *
 g = graph.graphxy(width=8)
 g.plot(graph.data.function("y(x)=sin(x)/x", min=-15, max=15))
 g.writePDFfile("function")

我想这样做来制作情节。

我正常运行

 C:\Users\Tony>py myplot.py

但我收到奇怪而冗长的错误消息:

 Traceback (most recent call last):
 File "myplot.py", line 4, in <module>
 g.writePDFfile("function")
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\sitepackages\pyx\canvas.py", line 50, in wrappedindocument
 return method(d, file, **write_kwargs)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site 
packages\pyx\document.py", line 193, in writePDFfile
 pdfwriter.PDFwriter(self, f, **kwargs)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\pdfwriter.py", line 316, in __init__
 catalog = PDFcatalog(document, self, registry)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\pdfwriter.py", line 143, in __init__
 self.PDFpages = PDFpages(document, writer, registry)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\pdfwriter.py", line 202, in __init__
 page = PDFpage(page, pageno, self, writer, registry)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\pdfwriter.py", line 236, in __init__
 self.PDFcontent = PDFcontent(page, writer, self.pageregistry)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\pdfwriter.py", line 268, in __init__
 page.processPDF(contentfile, awriter, acontext, registry, self.bbox)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\document.py", line 135, in processPDF
 self._process("processPDF", *args)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
  packages\pyx\document.py", line 129, in _process
 getattr(cc, processMethod)(contentfile, writer, context, registry, bbox)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\graph\graph.py", line 191, in processPDF
 canvas.canvas.processPDF(self, file, writer, context, registry, bbox)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\canvas.py", line 238, in processPDF
 item.processPDF(file, writer, context, registry, nbbox)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\canvas.py", line 238, in processPDF
  item.processPDF(file, writer, context, registry, nbbox)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\canvas.py", line 238, in processPDF
 item.processPDF(file, writer, context, registry, nbbox)
 [Previous line repeated 1 more time]
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\text.py", line 887, in processPDF
  self.dvicanvas.processPDF(file, writer, context, registry, abbox)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\text.py", line 851, in dvicanvas
 self.do_finish()
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
  packages\pyx\text.py", line 1212, in do_finish
 self.go_finish()
  File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
  packages\pyx\text.py", line 1338, in go_finish
 self._execute("\\end%\n", self.texmessages_end_default +
 self.texmessages_end, STATE_TYPESET, STATE_DONE)
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\text.py", line 1125, in _execute
 raise e
 File "C:\Users\Tony\Programs\Python\Python37-32\lib\site
 packages\pyx\text.py", line 1103, in _execute
 raise TexResultError("TeX dvifile messages expected")
 pyx.text.TexResultError: TeX dvifile messages expected
 The expression passed to TeX was:
 \end%
 After parsing the return message from TeX, the following was left:
 *(see the transcript file for additional information)
 Output written on "C:\Users\Tony\Temp\pyx3z6ter8i\texp
 ut.dvi" (25 pages, 1800 bytes).
 Transcript written on "C:\Users\Tony\Temp\pyx3z6ter8i\
 texput.log".

如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节?如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节?如何修复此错误并获取我的情节?如何修复此错误并获取我的情节? 如何修复此错误并获取我的情节?如何修复此错误并获取我的情节?

任何帮助深表感谢。 谢谢

您可以通过添加行来修复它

text.set(engine=text.TexEngine, texmessages_end=[text.texmessage.ignore])

紧接在 import 语句之后。 然而,这只会使问题沉默。 正确的修复将成为未来 PyX 版本的一部分(参见https://github.com/pyx-project/pyx/issues/8 )。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM