bastibe / transplant

Transplant is an easy way of calling Matlab from Python
https://transplant.readthedocs.io
Other
108 stars 26 forks source link

Support for environment variable passing added #57

Closed zanieb closed 4 years ago

zanieb commented 6 years ago

Matlab sometimes need to be run with a modified environment.

This PR adds support for modifying environment variables for the spawned matlab process.

e.g. mat = transplant.Matlab(executable='/opt/matlab/R2017a/bin/matlab', env=dict(LD_PRELOAD='/usr/lib64/libstdc++.so.6'))

bastibe commented 6 years ago

Thank you for this pull request.

I am a bit conflicted about your use case, though. Wouldn't it be easier to rename/delete Matlab's own libstdc++? That's what I typically do.

Apart from LD_PRELOAD, is there another use case, where this would be useful?

zanieb commented 6 years ago

I was also a bit conflicted about the use case, it seems like there would always be a way to fix the environment from Matlab's end. I'll do some research and see if people frequently change the environment for other purposes.

bastibe commented 6 years ago

OK, you do that.

At any rate, it might be worth considering to simply pass all additional keyword arguments of Matlab on to Popen.

zanieb commented 4 years ago

I clearly have not had time to look into this and will close this PR. Thanks for your time!

bastibe commented 4 years ago

It's been a while! But no worries, we all do this for fun. Stay safe!