Commit a8bd3756 authored by Jérome Perrin's avatar Jérome Perrin

collect: check python version and not just presence of subprocess32

promise are executed with the python interpreter running `slapos node
instance` and not with the python interpreter from the software. This
might be wrong.

When running slapos node on python3, we may be running scripts generated
for python3, ie. with subprocess32 installed. This becomes a problem
with python3.6 as it fails importing subprocess32
parent 4ca91227
from __future__ import print_function
from multiprocessing import Process, active_children, cpu_count, Pipe
try:
import subprocess32 as subprocess
except ImportError:
# When we run slapos node on python3 and install some software using python2,
# subprocess32 will be installed, because the working set is generated for
# the buildout python and not the python running slapos node instance.
# To workaround this, we don't check the presence of subprocess32 egg, but
# the fact that we run on python3.
import six
if six.PY2:
import subprocess32 as subprocess # pylint: disable=import-error
else:
import subprocess
import os
import signal
import sys
......
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