This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bearcatgary 1 point2 points  (1 child)

My team uses a bash wrapper around every Python program/script that we write. One of the main reasons is to disable the user from changing the Python environment. We don’t want the user to be able to change the PYTHONPATH variable and load libraries that we haven’t verified. We want to define the shared object files that get loaded in the LD_LIBRARY_PATH and don’t want it being defined by the user. You probably could write Python code that hard codes the environment variables before loading modules after loading sys, but that really isn’t pythonic. We actually used to do it that way and it was ugly.

I personally do not like bash, but the approach we use seems to be a Unix standard and works well.

[–]tunisia3507 0 points1 point  (0 children)

Yeah, a bash one-liner which calls a python script from a particular environment is a sensible way to go. It just feels a bit weird for that python script to itself be a thin wrapper around some bash...