"M.-A. Lemburg" <mal@lemburg.com> writes: > I've just run across a strange problem with SRE. The following > code does not run with the current CVS version -- the program > simply exists without notice even though there doesn't seem > to be an exit() or abort() call in SRE. Well, your regexp doesn't work for the given version: > Note that sys.version is > '2.2b1+ (#59, Nov 7 2001, 12:57:29) \n[GCC pgcc-2.95.2 19991024 > (release)]' > > Any ideas ? > > -- > import sys, re, string > _sys_version_parser = re.compile('([\w.]+)\s*' You need a \+? in here somewhere! Or a + inside the []. With this change, works fine on all Pythons I have here: [mwh@starship mwh]$ /usr/local/bin/python foo4.py 2.1.1 (#1, Aug 23 2001, 22:12:58) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] ('2.1.1', 1, 'Aug 23 2001 22:12:58', 'GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)') [mwh@starship mwh]$ /usr/bin/python foo4.py 1.5.2 (#1, Dec 21 2000, 15:29:08) [GCC egcs-2.91.66 19990314/Linux (egcs- ('1.5.2', 1, 'Dec 21 2000 15:29:08', 'GCC egcs-2.91.66 19990314/Linux (egcs-') [mwh@starship mwh]$ ~/bin/python foo4.py 2.2a4+ (#1, Oct 19 2001, 03:56:59) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] ('2.2a4.0', 1, 'Oct 19 2001 03:56:59', 'GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)') [mwh@starship mwh]$ ~/src/python/dist/src/build/python foo4.py 2.2b1+ (#1, Nov 7 2001, 05:07:34) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] ('2.2b1.0', 1, 'Nov 7 2001 05:07:34', 'GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)') Cheers, M. -- 40. There are two ways to write error-free programs; only the third one works. -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4