Commit 59a04869 authored by Julien Muchembled's avatar Julien Muchembled

Py3 fixes

parent 6999afe9
......@@ -89,7 +89,7 @@ class Handler(object):
kw['hostname'] = hostname
kw['port'] = port
python = path.join(self.office_binary_path, "python")
command_list = [path.exists(python) and python or "python",
command_list = [path.exists(python) and python or "python3",
pkg_resources.resource_filename(__name__,
path.join("helper", "unoconverter.py")),
"--uno_path=%s" % self.uno_path,
......
......@@ -35,7 +35,7 @@ import codecs
import helper_util
from os.path import dirname, splitext
from tempfile import mktemp
from base64 import decodestring, encodestring
from base64 import b64encode, b64decode
from getopt import getopt, GetoptError
try:
......@@ -342,7 +342,7 @@ def main():
elif opt == '--refresh':
refresh = json.loads(arg)
elif opt == '--metadata':
arg = decodestring(arg.encode('ascii')).decode('utf-8')
arg = b64decode(arg).decode('utf-8')
metadata = json.loads(arg)
elif opt == '--mimemapper':
mimemapper = json.loads(arg)
......@@ -357,7 +357,7 @@ def main():
output = unoconverter.convert(destination_format)
elif '--getmetadata' in param_list and not '--convert' in param_list:
metadata_dict = unoconverter.getMetadata()
output = encodestring(json.dumps(metadata_dict).encode('utf-8')).decode('utf-8')
output = b64encode(json.dumps(metadata_dict).encode('utf-8')).decode()
elif '--getmetadata' in param_list and '--convert' in param_list:
document_url = unoconverter.convert()
# Instanciate new UnoConverter instance with new url
......@@ -365,7 +365,7 @@ def main():
uno_path, office_binary_path, refresh)
metadata_dict = unoconverter.getMetadata()
metadata_dict['document_url'] = document_url
output = encodestring(json.dumps(metadata_dict).encode('utf-8')).decode('utf-8')
output = b64encode(json.dumps(metadata_dict).encode('utf-8')).decode()
elif '--setmetadata' in param_list:
unoconverter.setMetadata(metadata)
output = document_url
......
......@@ -118,7 +118,7 @@ class MimeMapper(object):
office_binary_path = kw.get("office_binary_path",
environ.get('office_binary_path'))
python = path.join(office_binary_path, "python")
command = [path.exists(python) and python or "python",
command = [path.exists(python) and python or "python3",
pkg_resources.resource_filename(__name__,
path.join("helper", "unomimemapper.py")),
"--uno_path=%s" % uno_path,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment