diff options
author | lloyd <[email protected]> | 2012-07-18 14:41:11 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-07-18 14:41:11 +0000 |
commit | 3a86d597322422eec70f0265f7c2e98a4caea033 (patch) | |
tree | 9d29f4c70333379ac7d2e6ed848bc3e5ad9472f2 | |
parent | ed93f55a8dbbf7b8a2a6e0b5dd5ed390e30f34ec (diff) |
Add FAQ entry for old Pythons having issues with configure
-rw-r--r-- | doc/faq.rst | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/faq.rst b/doc/faq.rst index 5c74e79f1..429c6340b 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -45,6 +45,36 @@ source file which you can easily include in your existing application build. This feature is available in all versions of 1.10 and all later branches. +Why do I get a SyntaxError when I run configure.py? +---------------------------------------------------- + +The ``configure.py`` script in 1.10 and later versions requires Python +2.6 or higher. In Python 3 the exception catching syntax changed, and +while 2.6 and 2.7 understand both syntaxes, 2.5 does not. If you see +an error like this:: + + File "./configure.py", line 62 + except OSError as e: + ^ + SyntaxError: invalid syntax + +Then you are using Python 2.5 (or earlier). For Python 2.5, a Perl +one liner can fix the syntax:: + + perl -pi -e "s/except (.*) as (.*):/except $1, $2:/g" configure.py + +or in Python:: + + import re + + lines = re.sub(r"except (.*) as (.*):", r"except \1, \2:", + "".join(open("configure.py").readlines())) + open("configure.py", "w").write(lines) + +However Python 2.4 is missing a number of features and cannot be used +to configure the build in 1.10; you'll need to upgrade to at least 2.5 +(or preferably 2.7 or 3.1). + The self-test program can't locate the library ----------------------------------------------- |