rh0dium schrieb: >>Python usually installs so the latest version gets linked as >>/usr/bin/python. HTere's no need to bind your scripts to a particular >>version. >> >>regards > > > True - but that entirely depends on your path. Example: > > Redhat (RHEL3) ships with python2.3 in /usr/bin > Adding an 2.5 version to /usr/local/bin > > set PATH=/usr/local/bin:/usr/bin > > "python" - will use 2.5 > > Conversely if you: > set PATH=/usr/bin:/usr/local/bin > > "python" - will use 2.3 > > but if I wanted to ensure I was using 2.5 I would simply type > python2.5 I want to ensure that the python version I am using is at > lease 2.4 > > >
#!/usr/bin/env python and from sys import version_info if version_info[0] < 2 or version_info[1] < 4: raise RuntimeError("You need at least python2.4 to run this script") IMO you shouldn't struggle with it too hard. If the user's python version is not appropriate, don't hack its interpreter mechanism to do the work you need. Anyways, you should not check for specific python versions but for modules/APIs/builtins whatever and *then* you may raise an exception pointing the user to the fact that is python version does not fit your needs. HTH, Stargaming -- http://mail.python.org/mailman/listinfo/python-list