搜尋

首頁  >  問答  >  主體

python2.7 - python mammoth zipfile.BadZipfile: File is not a zip file

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

<code class="php">#mammoth 是一个将docx文件转换为HTML文件的库,执行报错如下

$ mammoth.exe test.docx  test.html

Traceback (most recent call last):

  File "d:\python27\lib\runpy.py", line 162, in _run_module_as_main

    "__main__", fname, loader, pkg_name)

  File "d:\python27\lib\runpy.py", line 72, in _run_code

    exec code in run_globals

  File "d:\Python27\Scripts\mammoth.exe\__main__.py", line 9, in <module>

  File "d:\python27\lib\site-packages\mammoth\cli.py", line 33, in main

    output_format=args.output_format,

  File "d:\python27\lib\site-packages\mammoth\__init__.py", line 20, in convert

    kwargs["style_map"] = read_style_map(fileobj)

  File "d:\python27\lib\site-packages\mammoth\docx\style_map.py", line 66, in re

ad_style_map

    with open_zip(fileobj, "r") as zip_file:

  File "d:\python27\lib\site-packages\mammoth\zips.py", line 9, in open_zip

    return _Zip(ZipFile(fileobj, mode))

  File "d:\python27\lib\zipfile.py", line 770, in __init__

    self._RealGetContents()

  File "d:\python27\lib\zipfile.py", line 811, in _RealGetContents

    raise BadZipfile, "File is not a zip file"

zipfile.BadZipfile: File is not a zip file</code>

ringa_leeringa_lee2808 天前1718

全部回覆(0)我來回復

無回覆
  • 取消回覆