Make sure to execute python2 scripts with python2

This commit is contained in:
Jean-Francois Dockes 2015-11-16 15:18:59 +01:00
parent 683a258d4d
commit 953144d131
3 changed files with 9 additions and 7 deletions

View File

@ -133,10 +133,10 @@ class WordFilter:
mt = self.mimetype(fn)
self.em.rclog("rcldoc.py: actual MIME type %s" % mt)
if mt == "text/plain":
return (["python", os.path.join(self.execdir, "rcltext.py")],
return ([sys.executable, os.path.join(self.execdir, "rcltext.py")],
WordPassData(self.em))
elif mt == "text/rtf":
cmd = ["python", os.path.join(self.execdir, "rclrtf.py"),
cmd = [sys.executable, os.path.join(self.execdir, "rclrtf.py"),
"-s"]
self.em.rclog("rcldoc.py: returning cmd %s" % cmd)
return (cmd, WordPassData(self.em))

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python2
# Recoll PPT text extractor
# Msodump is not compatible with Python3 AFAIK, so this is stuck to
# Python2 too
# Mso-dumper is not compatible with Python3. We use sys.executable to
# start the actual extractor, so we need to use python2 too.
from __future__ import print_function
@ -46,7 +46,7 @@ class PPTFilter:
cmd = rclexecm.which("ppt-dump.py")
if cmd:
# ppt-dump.py often exits 1 with valid data. Ignore exit value
return (["python", cmd, "--no-struct-output", "--dump-text"],
return ([sys.executable, cmd, "--no-struct-output", "--dump-text"],
PPTProcessData(self.em), rclexec1.Executor.opt_ignxval)
else:
return ([], None)

View File

@ -1,7 +1,9 @@
#!/usr/bin/env python2
# Extractor for Excel files.
# Mso-dumper is not compatible with Python3
# Mso-dumper is not compatible with Python3. We use sys.executable to
# start the actual extractor, so we need to use python2 too.
import rclexecm
import rclexec1
import xlsxmltocsv
@ -48,7 +50,7 @@ class XLSFilter:
cmd = rclexecm.which("xls-dump.py")
if cmd:
# xls-dump.py often exits 1 with valid data. Ignore exit value
return (["python", cmd, "--dump-mode=canonical-xml", \
return ([sys.executable, cmd, "--dump-mode=canonical-xml", \
"--utf-8", "--catch"],
XLSProcessData(self.em), rclexec1.Executor.opt_ignxval)
else: