Your Linux Data Center Experts

One problem that production system administrators have is running systems with older Python versions installed as /usr/bin/python. Worse, you probably have some systems with a newer Python and some with an older Python. For example, in our environment we're managing some systems with Python 2.1 and some with Python 2.6…

And you can't just upgrade /usr/bin/python, because that will likely break many other things on the system, mean that packages that provide modules either have to be rebuilt or are no longer reachable by the Python interpreter, etc…

We've been struggling with this for one of our system maintenance packages, where there is newer Python available on the system, but just doing “#!/usr/bin/env python” will pick up a very old version.

The “ineedpy2” module will either try to find a newer Python version and re-run the currently-running program with that, or you can specify a minimum minor Python 2 version that you need, and only if you are running something older than that will it swap in a newer one. For example, you may have both Python 2.6 and Python 2.4 on a system, but 2.4 is sufficient, so you don't need to do the extra work, but if you are running under 2.3 it will.

For example, you can say “ineedpy2.rerunonlatest()” to get the latest available Python on the system, or “ineedpy2.requireminor(4)” to only re-run the program if you are on 2.3 or older.

I've released this module on github at and will put it in pypi soon.

comments powered by Disqus

Join our other satisfied clients. Contact us today.