Commit da27efbb authored by murban's avatar murban
Browse files

Set python hardcoded on version 2

parent 510d999e
...@@ -155,7 +155,7 @@ class LocalConnectionImpl(object): ...@@ -155,7 +155,7 @@ class LocalConnectionImpl(object):
_local_connection_feeder = None _local_connection_feeder = None
def __init__(self, command, **kwargs): def __init__(self, command, **kwargs):
if command[0] == "python" and not sys.platform.startswith("java"): if command[0] == "python2" and not sys.platform.startswith("java"):
command[0] = sys.executable command[0] = sys.executable
logger.info("local connection: %s" % " ".join(command)) logger.info("local connection: %s" % " ".join(command))
self.__proc = subprocess.Popen(command, stdin=subprocess.PIPE, self.__proc = subprocess.Popen(command, stdin=subprocess.PIPE,
...@@ -285,7 +285,7 @@ class SSHConnectionImpl(object): ...@@ -285,7 +285,7 @@ class SSHConnectionImpl(object):
else: else:
if missing_host_key_policy != "reject": if missing_host_key_policy != "reject":
import warnings import warnings
warnings.warn("Unknown missing host key policy: " + warnings.warn("Unknown missing host key policy: " +
missing_host_key_policy) missing_host_key_policy)
self.__client.set_missing_host_key_policy( self.__client.set_missing_host_key_policy(
paramiko.RejectPolicy()) paramiko.RejectPolicy())
...@@ -451,7 +451,7 @@ class Connection(object): ...@@ -451,7 +451,7 @@ class Connection(object):
self.__userid = userid self.__userid = userid
self.__workspaceid = workspaceid self.__workspaceid = workspaceid
self.__host = host self.__host = host
self.__python = kwargs.get('python', 'python') or "python" self.__python = kwargs.get('python', 'python2') or "python2"
self.__username = kwargs.get('username', None) self.__username = kwargs.get('username', None)
self.__server = None self.__server = None
self.__tempdir = kwargs.get("tempdir", "") self.__tempdir = kwargs.get("tempdir", "")
...@@ -482,16 +482,16 @@ class Connection(object): ...@@ -482,16 +482,16 @@ class Connection(object):
MAGIC_STRING = "START_RPYC".encode("ascii") MAGIC_STRING = "START_RPYC".encode("ascii")
MAGIC_STRING_LENGTH = len(MAGIC_STRING) MAGIC_STRING_LENGTH = len(MAGIC_STRING)
buf = b'' buf = b''
while True: while True:
# fill buffer to needed size # fill buffer to needed size
remaining = MAGIC_STRING_LENGTH - len(buf) remaining = MAGIC_STRING_LENGTH - len(buf)
buf += self._connection.stdout.read(remaining) buf += self._connection.stdout.read(remaining)
# compare # compare
if buf == MAGIC_STRING: if buf == MAGIC_STRING:
return return
# jump to next S # jump to next S
try: try:
buf = buf[buf.index(MAGIC_STRING[0], 1):] buf = buf[buf.index(MAGIC_STRING[0], 1):]
...@@ -694,7 +694,7 @@ class Connection(object): ...@@ -694,7 +694,7 @@ class Connection(object):
def rpyc(self): def rpyc(self):
return self.__rpyc return self.__rpyc
def errors(self): def errors(self):
for i, line in enumerate(self._connection.stderr): for i, line in enumerate(self._connection.stderr):
line = line.rstrip() line = line.rstrip()
...@@ -761,7 +761,7 @@ class ConnectionPool(object): ...@@ -761,7 +761,7 @@ class ConnectionPool(object):
key = (user.id, workspace.id) key = (user.id, workspace.id)
if key in self._connections and self._connections[key].active(): if key in self._connections and self._connections[key].active():
logger.debug( logger.debug(
"workspace already conected: %d - %d" % "workspace already conected: %d - %d" %
(user.id, workspace.id)) (user.id, workspace.id))
self._connections[key].send_status() self._connections[key].send_status()
return self._connections[key] return self._connections[key]
...@@ -791,7 +791,7 @@ class ConnectionPool(object): ...@@ -791,7 +791,7 @@ class ConnectionPool(object):
def clear(self, user=None, workspace=None): def clear(self, user=None, workspace=None):
uid = user.id if type(user) == User else user uid = user.id if type(user) == User else user
wid = workspace.id if type(workspace) == Workspace else workspace wid = workspace.id if type(workspace) == Workspace else workspace
for _uid, _wid in self._connections.keys(): for _uid, _wid in self._connections.keys():
if uid and uid != _uid: if uid and uid != _uid:
continue continue
if wid and wid != _wid: if wid and wid != _wid:
...@@ -803,7 +803,7 @@ class ConnectionPool(object): ...@@ -803,7 +803,7 @@ class ConnectionPool(object):
c = self._connections[key] c = self._connections[key]
del self._connections[key] del self._connections[key]
c.close() c.close()
return return
# not found, send topic anyway # not found, send topic anyway
......
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