【问题标题】:Exception in tkinter callback: failed with exit code 3221225781tkinter 回调中的异常:失败,退出代码 3221225781
【发布时间】:2020-08-12 08:53:17
【问题描述】:

不知何故,我通过将 poppler 添加到我的 PATH 环境变量中,以错误代码 127 修复了先前的错误,但是现在我受到了这个新错误的欢迎。有谁知道这可能意味着什么以及如何解决它。我正在尝试运行我在 MAC 上创建的工具,以使用 textract 将 PDF 读取为文本。它在 MacOS 上运行良好但是它似乎在 Windows 上运行有问题。任何帮助将不胜感激。

提前致谢:)

Exception in Tkinter callback
Traceback (most recent call last):
  File "tkinter\__init__.py", line 1883, in __call__
  File "\\Mac\Home\PycharmProjects\WickeyEinkaufAutomation\EinkaufRGWindows.py", line 40, in InkoopRekeningen
    text = textract.process(str(importfolder) + str(i))
  File "site-packages\textract\parsers\__init__.py", line 77, in process
  File "site-packages\textract\parsers\utils.py", line 46, in process
  File "site-packages\textract\parsers\pdf_parser.py", line 28, in extract
  File "site-packages\textract\parsers\pdf_parser.py", line 20, in extract
  File "site-packages\textract\parsers\pdf_parser.py", line 43, in extract_pdftotext
  File "site-packages\textract\parsers\utils.py", line 100, in run
textract.exceptions.ShellError: The command `pdftotext //Mac/Home/Desktop/WET/Rekeningen/Lekkerkerker_ - 20803471.pdf -` failed with exit code 3221225781
------------- stdout -------------
b''------------- stderr -------------
b''

【问题讨论】:

  • 检查错误消息中的命令,路径似乎不合逻辑...没有引用空格,另外//Mac/Home 看起来很奇怪
  • @CherryDT 它被称为 //Mac/Home 因为我通过并行在虚拟机上运行它,删除文件名中的空格会解决您认为的问题吗?
  • 尝试在文件名上使用shlex.quote()text = textract.process(shlex.quote(str(importfolder)+str(i)))
  • 不应该是\\Mac\Home吗?斜线在您的路径中的方向错误。同样是的,要么不使用空格,要么将文件名放在引号中。

标签: python tkinter pdftotext poppler


【解决方案1】:

MacOS 和 Windows 上的路径使用不同的斜线,因此 MacOS 程序也需要更改才能在 Windows 上运行。 Mac 使用 / 斜杠,而 Windows - .

【讨论】:

    猜你喜欢
    • 2020-06-06
    • 2021-08-02
    • 2021-06-09
    • 2021-06-20
    • 2020-11-06
    • 1970-01-01
    • 2021-09-12
    • 2021-06-13
    • 2021-10-01
    相关资源
    最近更新 更多