more py3 fixups
This commit is contained in:
parent
d70569382f
commit
e33904d65c
2 changed files with 13 additions and 8 deletions
|
@ -1,10 +1,14 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python2
|
||||||
#
|
#
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# mso-dumper is not compatible with python3
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys, os.path, getopt
|
import sys, os.path, getopt
|
||||||
sys.path.append(sys.path[0]+"/msodump.zip")
|
sys.path.append(sys.path[0]+"/msodump.zip")
|
||||||
from msodumper import ole, pptstream, globals, olestream
|
from msodumper import ole, pptstream, globals, olestream
|
||||||
|
@ -21,7 +25,7 @@ Options:
|
||||||
--no-raw-dumps suppress raw hex dumps of uninterpreted areas
|
--no-raw-dumps suppress raw hex dumps of uninterpreted areas
|
||||||
--id-select=id1[,id2 ...] limit output to selected record Ids
|
--id-select=id1[,id2 ...] limit output to selected record Ids
|
||||||
""" % exname
|
""" % exname
|
||||||
print msg
|
print(msg)
|
||||||
|
|
||||||
|
|
||||||
class PPTDumper(object):
|
class PPTDumper(object):
|
||||||
|
|
|
@ -152,25 +152,26 @@ class OXExtractor:
|
||||||
fn = params["filename:"]
|
fn = params["filename:"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
zip = ZipFile(fn)
|
f = open(fn, 'rb')
|
||||||
|
zip = ZipFile(f)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.em.rclog("unzip failed: " + str(err))
|
self.em.rclog("unzip failed: " + str(err))
|
||||||
return (False, "", "", rclexecm.RclExecM.eofnow)
|
return (False, "", "", rclexecm.RclExecM.eofnow)
|
||||||
|
|
||||||
docdata = '<html><head>'
|
docdata = b'<html><head>'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
metadata = zip.read("docProps/core.xml")
|
metadata = zip.read("docProps/core.xml")
|
||||||
if metadata:
|
if metadata:
|
||||||
res = rclxslt.apply_sheet_data(meta_stylesheet, metadata)
|
res = rclxslt.apply_sheet_data(meta_stylesheet, metadata)
|
||||||
docdata += res
|
docdata += res
|
||||||
except:
|
except Exception as err:
|
||||||
# To be checked. I'm under the impression that I get this when
|
# To be checked. I'm under the impression that I get this when
|
||||||
# nothing matches?
|
# nothing matches?
|
||||||
# self.em.rclog("no/bad metadata in %s" % fn)
|
self.em.rclog("no/bad metadata in %s: %s" % (fn, err))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
docdata += '</head><body>'
|
docdata += b'</head><body>'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content= zip.read('word/document.xml')
|
content= zip.read('word/document.xml')
|
||||||
|
@ -197,7 +198,7 @@ class OXExtractor:
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
docdata += '</body></html>'
|
docdata += b'</body></html>'
|
||||||
|
|
||||||
return (True, docdata, "", rclexecm.RclExecM.eofnext)
|
return (True, docdata, "", rclexecm.RclExecM.eofnext)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue