Skip to content

Commit

Permalink
Merge pull request #2446 from sildar/3.4.5
Browse files Browse the repository at this point in the history
Fix #2444 by having a special case for py 2.7
  • Loading branch information
stevenbird committed Nov 12, 2019
2 parents acca8d5 + 3d5e597 commit 6b0312a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nltk/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ def java(cmd, classpath=None, stdin=None, stdout=None, stderr=None, blocking=Tru
:raise OSError: If the java command returns a nonzero return code.
"""

subprocess_output_dict = {'pipe': subprocess.PIPE, 'stdout': subprocess.STDOUT, 'devnull': subprocess.DEVNULL}
try:
from subprocess import DEVNULL
except ImportError:
DEVNULL = open(os.devnull, 'wb')
subprocess_output_dict = {'pipe': subprocess.PIPE, 'stdout': subprocess.STDOUT, 'devnull': DEVNULL}

stdin = subprocess_output_dict.get(stdin, stdin)
stdout = subprocess_output_dict.get(stdout, stdout)
Expand Down

0 comments on commit 6b0312a

Please sign in to comment.