python-pptx throwing error on loading (2003 converted) 2010 powerpoint document in windows 7 64x ? -
i'm using python-pptx version 0.5.7 - windows 7 64x. i'm not sure how procedure able find online didn't work. i'm not sure why zip file error since powerpoint document.
as help.
>>> pptx import presentation >>> f = open("randy-diehl-analysis.pptx") >>> prs = presentation(f) traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\site-packages\pptx\api.py", line 26, in __init__ self._package = package.open(pkg_file) file "c:\python27\lib\site-packages\pptx\package.py", line 44, in open return super(package, cls).open(pkg_file) file "c:\python27\lib\site-packages\pptx\opc\package.py", line 122, in open pkg_reader = packagereader.from_file(pkg_file) file "c:\python27\lib\site-packages\pptx\opc\pkgreader.py", line 32, in from_file phys_reader = physpkgreader(pkg_file) file "c:\python27\lib\site-packages\pptx\opc\phys_pkg.py", line 102, in __init__ self._zipf = zipfile(pkg_file, 'r') file "c:\python27\lib\zipfile.py", line 712, in __init__ self._getcontents() file "c:\python27\lib\zipfile.py", line 746, in _getcontents self._realgetcontents() file "c:\python27\lib\zipfile.py", line 787, in _realgetcontents centdir = struct.unpack(structcentraldir, centdir) struct.error: unpack requires string argument of length 46
i needed specify read , write parameters use file.
f = open("randy-diehl-analysis.pptx", "r+b")
Comments
Post a Comment