#!/usr/bin/env python > 2.4?
starGaming at gmail.com
starGaming at gmail.com
Thu Mar 22 12:22:09 EDT 2007
On Mar 21, 11:11 pm, Sander Steffann <s.steff... at computel.nl> wrote:
> Hi,
>
> Op 21-mrt-2007, om 20:41 heeft starGam... at gmail.com het volgende
> geschreven:
>
>
>
> > On Mar 21, 11:07 am, Jon Ribbens <jon+use... at unequivocal.co.uk> wrote:
> >> In article <etpcon$1g8... at ulysses.news.tiscali.de>, Stargaming wrote:
> >>> 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")
>
> >> That'll fail when the major version number is increased (i.e.
> >> Python 3.0).
>
> >> You want:
>
> >> if sys.hexversion < 0x020400f0:
> >> ... error ...
>
> > Yes, it was intended to be and 'and' instead of an 'or'.
>
> If you make it an 'and' it will not raise the exception on version
> like 1.5 or 2.3... If you realy want to use version_info, you'll have
> to do something like:
>
> if version_info[0] < 2 or (version_info[0] == 2 and version_info[1] <
> 4):
> raise RuntimeError
>
> - Sander
I don't see any problem with::
if version_info[0] <= 2 and version_info[1] < 4:
raise RuntimeError()
Huh?
More information about the Python-list
mailing list