I'm using system() to call an external python script that does some file processing for me but I get a segmentation fault with exit code 139 when I try and run. EX: system('python my_python_script.py')
I am confident that it is not an issue with the python script as I can run it successfully through the terminal without Matlab. The script uses some environment variables and all of my python libraries are installed in a virtual environment (where I launch Matlab from). I'm thinking the issue is either with the virtual environment or the environment variables but I am not 100% sure what to do to ensure that the all the dependencies are shared between Matlab's sytem call and my normal terminal call to the script. I've reviewed the information on this site: https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html but I'm not sure about the environment variables. Any suggestions?
EDIT: I should have added more information. I am running on Ubuntu 16.04 and Matlab 2021a. The python script does some parallel processing of data and saves off the results that Matlab does not need access to. Really I just want to call the Python script in a loop with variable inputs as the Matlab script does some of the pre-processing before the Python script can run. I also checked that Matlab's system call has access to the environment variables that the Python script uses and it does so I believe it's an issue with one of the libraries that Matlab uses that is incompatible with what I am trying to do in Python. I don't know how to find out which library might be causing this however if that is the case.