Use thread-safe subprocess32 on Py2

This commit is contained in:
Jan Blechta 2016-12-08 14:30:48 +01:00
parent 8d63ae1ac5
commit 31ace18e1c
1 changed files with 10 additions and 1 deletions

View File

@ -31,7 +31,6 @@ the current version
"""
import os
import subprocess
import sys
from time import clock
try:
@ -47,6 +46,16 @@ from .constants import *
import logging
log = logging.getLogger(__name__)
if os.name == "posix" and sys.version_info[0] < 3:
try:
import subprocess32 as subprocess
except ImportError:
log.debug("Thread-safe subprocess32 module not found! "
"Using unsafe built-in subprocess module instead.")
import subprocess
else:
import subprocess
class PulpSolverError(PulpError):
"""
Pulp Solver-related exceptions