用txt和xlsx测试过,都失败了。:
F:\Programs\Mdx\Converter
λ MdxConverter.exe 2.mdx 2.txt 2.pdf
Lesson 1
meanings
Traceback (most recent call last):
File “MdxConverter.py”, line 258, in
File “MdxConverter.py”, line 221, in mdx2pdf
File “MdxConverter.py”, line 206, in mdx2html
File “MdxConverter.py”, line 91, in merge_css
File “MdxConverter.py”, line 87, in get_css
AttributeError: ‘str’ object has no attribute ‘decode’
[26348] Failed to execute script MdxConverter
求教如何解决这个错误,以及如果无法解决有没有可用的工具。
F:\Programs\Mdx\Converter
λ MdxConverter.exe 2.mdx 2.txt 2.pdf
Lesson 1
meanings
Traceback (most recent call last):
File “MdxConverter.py”, line 258, in
File “MdxConverter.py”, line 221, in mdx2pdf
File “MdxConverter.py”, line 206, in mdx2html
File “MdxConverter.py”, line 91, in merge_css
File “MdxConverter.py”, line 87, in get_css
AttributeError: ‘str’ object has no attribute ‘decode’
[26348] Failed to execute script MdxConverter
现在测试了另一个文件,出现了另一种错误:
F:\Programs\Mdx\Converter
λ MdxConverter.exe 1.mdx 2.txt 2.html
Traceback (most recent call last):
File “MdxConverter.py”, line 258, in
File “MdxConverter.py”, line 150, in mdx2html
File “MdxConverter.py”, line 43, in get_words
File “MdxConverter.py”, line 52, in get_words_from_txt
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xbf in position 2: illegal multibyte sequence
[54672] Failed to execute script MdxConverter
试图直接输出pdf还是出错
F:\Programs\Mdx\Converter
λ MdxConverter.exe 1.mdx 2.txt 3.pdf
Lesson 1
arm
Traceback (most recent call last):
File “site-packages\pdfkit\configuration.py”, line 21, in init
OSError: [Errno 22] Invalid argument: b’F:\Programs\Mdx\Converter\wkhtmltopdf.exe\r\nF:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “MdxConverter.py”, line 258, in
File “MdxConverter.py”, line 222, in mdx2pdf
File “site-packages\pdfkit\api.py”, line 47, in from_file
File “site-packages\pdfkit\pdfkit.py”, line 42, in init
File “site-packages\pdfkit\configuration.py”, line 27, in init
OSError: No wkhtmltopdf executable found: “b’F:\Programs\Mdx\Converter\wkhtmltopdf.exe\r\nF:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe’”
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - Installing wkhtmltopdf · JazzCore/python-pdfkit Wiki · GitHub
[94796] Failed to execute script MdxConverter
改这一行for line in open(name,encoding=‘utf-8’).readlines():
再运行出现:F:\Programs\Mdx\Converter
λ MdxConverter.py 1.mdx 2.txt 4.html
Traceback (most recent call last):
File “F:\Programs\Mdx\Converter\MdxConverter-master\MdxConverter.py”, line 3, in
import mdict_query
ModuleNotFoundError: No module named ‘mdict_query’
F:\Programs\Mdx\Converter
λ MdxConverter.py 1.mdx 2.txt 4.html
Traceback (most recent call last):
File “F:\Programs\Mdx\Converter\MdxConverter-master\MdxConverter.py”, line 3, in
import mdict_query
File “F:\Programs\Mdx\Converter\MdxConverter-master\mdict_query.py”, line 13, in
from .readmdict import MDD, MDX
ImportError: attempted relative import with no known parent package