Fixed issue running BAM on Windows.

I found this solution in a Django bug report:
 https://code.djangoproject.com/ticket/24160
This commit is contained in:
Sybren A. Stüvel 2017-07-03 09:13:49 +02:00
parent 2fa8cb4054
commit 66ddc7b47b

View File

@ -50,6 +50,7 @@ async def bam_copy(base_blendfile: Path, target_blendfile: Path,
""" """
import asyncio import asyncio
import os
import shlex import shlex
import subprocess import subprocess
@ -76,9 +77,17 @@ async def bam_copy(base_blendfile: Path, target_blendfile: Path,
else: else:
pythonpath = wheel_pythonpath_278() pythonpath = wheel_pythonpath_278()
env = {
'PYTHONPATH': pythonpath,
# Needed on Windows because http://bugs.python.org/issue8557
'PATH': os.environ['PATH'],
}
if 'SYSTEMROOT' in os.environ: # Windows http://bugs.python.org/issue20614
env['SYSTEMROOT'] = os.environ['SYSTEMROOT']
proc = await asyncio.create_subprocess_exec( proc = await asyncio.create_subprocess_exec(
*args, *args,
env={'PYTHONPATH': pythonpath}, env=env,
stdin=subprocess.DEVNULL, stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,