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
|
||||
# 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/.
|
||||
#
|
||||
|
||||
# mso-dumper is not compatible with python3
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys, os.path, getopt
|
||||
sys.path.append(sys.path[0]+"/msodump.zip")
|
||||
from msodumper import ole, pptstream, globals, olestream
|
||||
|
@ -21,7 +25,7 @@ Options:
|
|||
--no-raw-dumps suppress raw hex dumps of uninterpreted areas
|
||||
--id-select=id1[,id2 ...] limit output to selected record Ids
|
||||
""" % exname
|
||||
print msg
|
||||
print(msg)
|
||||
|
||||
|
||||
class PPTDumper(object):
|
||||
|
|
|
@ -152,25 +152,26 @@ class OXExtractor:
|
|||
fn = params["filename:"]
|
||||
|
||||
try:
|
||||
zip = ZipFile(fn)
|
||||
f = open(fn, 'rb')
|
||||
zip = ZipFile(f)
|
||||
except Exception as err:
|
||||
self.em.rclog("unzip failed: " + str(err))
|
||||
return (False, "", "", rclexecm.RclExecM.eofnow)
|
||||
|
||||
docdata = '<html><head>'
|
||||
docdata = b'<html><head>'
|
||||
|
||||
try:
|
||||
metadata = zip.read("docProps/core.xml")
|
||||
if metadata:
|
||||
res = rclxslt.apply_sheet_data(meta_stylesheet, metadata)
|
||||
docdata += res
|
||||
except:
|
||||
except Exception as err:
|
||||
# To be checked. I'm under the impression that I get this when
|
||||
# nothing matches?
|
||||
# self.em.rclog("no/bad metadata in %s" % fn)
|
||||
self.em.rclog("no/bad metadata in %s: %s" % (fn, err))
|
||||
pass
|
||||
|
||||
docdata += '</head><body>'
|
||||
docdata += b'</head><body>'
|
||||
|
||||
try:
|
||||
content= zip.read('word/document.xml')
|
||||
|
@ -197,7 +198,7 @@ class OXExtractor:
|
|||
except:
|
||||
pass
|
||||
|
||||
docdata += '</body></html>'
|
||||
docdata += b'</body></html>'
|
||||
|
||||
return (True, docdata, "", rclexecm.RclExecM.eofnext)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue