python-subprocess32
python-subprocess32 copied to clipboard
Different behaviour when running subprocess in python 2.7.12 and python 3.6.9
Hi,
I am trying to execute a process from python, specifically CASA NRAO 5.7 which is a Python 2.7.12 environment plus some radio astronomical functions. The thing is that when I run my process using subprocess whether in just Python 2.7.12 or CASA I get a std::bad_alloc error, and that does not happen in Python 3.6.9. I have installed subprocess32 to see if this behaviour continued in Python 2.7 and yes, it continues. I don't know what change could be done to the subprocess library that make my program work in Python 3.6.9.
I am basically running this code:
import numpy as np
import os
if os.name == 'posix' and sys.version_info[0] < 3:
import subprocess32 as subprocess
else:
import subprocess
import shlex
args = "/home/miguel/Documents/gpuvmem/bin/gpuvmem -X 16 -Y 16 -V 256 -i A1314.ms.selfcal -o selfcal_data/output_residuals.ms -z 0.001,3.5 -Z 0.008,0.0,0.0 -G 1 -m output_ph3.image.fits -O selfcal_data/output.fits -I input_example.dat -R 2.0 -t 100000 -g 20 --verbose --savemodel-input"
args = shlex.split(args)
p2 = subprocess.Popen(args, bufsize=-1, shell=False)
p2.wait()
Best regards