Commit e45e2121 authored by Gabriel Monnerat's avatar Gabriel Monnerat

use pkg_resources instead of import the package. Don't to use sys.executable...

use pkg_resources instead of import the package. Don't to use sys.executable in this cases, because if this is invokepython(), segmentation fault occurs with the subprocess

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@38626 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 667d004e
......@@ -26,17 +26,17 @@
#
##############################################################################
import pkg_resources
from os import environ
from os.path import exists, join
from subprocess import Popen, PIPE
from threading import Lock
from zope.interface import implements
from application import Application
from sys import executable as python_path
from xvfb import xvfb
from cloudooo.interfaces.lockable import ILockable
from cloudooo.utils import logger, waitStartDaemon, removeDirectory, \
waitStopDaemon, convertStringToBool
waitStopDaemon, convertStringToBool
class OpenOffice(Application):
"""Object to control one OOo Instance and all features instance."""
......@@ -57,9 +57,9 @@ class OpenOffice(Application):
def _testOpenOffice(self, host, port):
"""Test if OpenOffice was started correctly"""
logger.debug("Test OpenOffice %s - Pid %s" % (self.getAddress()[-1], self.pid()))
command = [python_path
, "'-c'"
, "'from cloudooo.bin.openoffice_tester import main;main()'"
command = ["python"
, pkg_resources.resource_filename("cloudooo",
join("helper", "openoffice_tester.py"))
, "'--hostname=%s'" % host
, "'--port=%s'" % port
, "'--uno_path=%s'" % self.uno_path]
......
......@@ -69,7 +69,7 @@ class OOHandler:
hostname, port = openoffice.getAddress()
kw['hostname'] = hostname
kw['port'] = port
command_list = [python_path
command_list = ["python"
, pkg_resources.resource_filename("cloudooo",
path.join("helper", "unoconverter.py"))
, "--uno_path='%s'" % self.uno_path
......
......@@ -32,7 +32,6 @@ from subprocess import Popen, PIPE
from zope.interface import implements
from filter import Filter
from os import environ, path
from sys import executable as python_path
from interfaces.mimemapper import IMimemapper
from types import InstanceType
......@@ -107,7 +106,7 @@ class MimeMapper(object):
uno_path = kw.get("uno_path", environ.get('uno_path'))
office_binary_path = kw.get("office_binary_path",
environ.get('office_binary_path'))
command = [python_path
command = ["python"
, 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