Merge pull request #119 from blechta/use-subprocess32

Use thread-safe subprocess32 on Py2
This commit is contained in:
Stuart Mitchell 2017-02-06 23:59:18 +13:00 committed by GitHub
commit 95c6c9aee9
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