[PATCH] handle non-integer sub-versions
Aaron Bentley
aaron.bentley at utoronto.ca
Wed May 18 19:16:21 BST 2005
urlgrabber parses the Python version string, but doesn't handle all
possibilities correctly; it assumes all integers, and some python
installs will have something different. For my install, sys.version
reads: "2.3.4c1 (#4, Jul 20 2004, 08:57:39)
[GCC 2.95.4 20011002 (Debian prerelease)]"
The same info is available pre-parsed from sys.version_info. Here's a
patch that just does that:
*** modified file 'urlgrabber/keepalive.py'
--- urlgrabber/keepalive.py
+++ urlgrabber/keepalive.py
@@ -110,7 +110,7 @@
def DBPRINT(*args): print ' '.join(args)
import sys
-_python_version = map(int, sys.version.split()[0].split('.'))
+_python_version = sys.version_info
if _python_version < [2, 4]: HANDLE_ERRORS = 1
else: HANDLE_ERRORS = 0
If for some reason you really want to parse it yourself, you can do
_python_version = map(int, sys.version.split()[0].split('.')[:2])
Aaron
More information about the bazaar
mailing list