[Zope] psycopg import error

Thomas OConnor Thomas.OConnor at newcastle.edu.au
Wed Jul 1 21:51:33 EDT 2009


I also experienced the problem this morning when trying to use the product ZPsycopgDA version 2.0.11 on Zope.  The error reported by Plone/Zope is:

Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))

Due to the fact it is extracting the first 5 characters (2.0.1) and comparing it to the full version (2.0.11), thus failing.

Instead of changing the index to 6 (which would then break 2.0.8 versions, etc.), you can explode the string by spaces, then extract the first part:

so the only change would be to line 119 of DA.py, from:
        if psycopg2.__version__[:5] not in ALLOWED_PSYCOPG_VERSIONS:

        if psycopg2.__version__.split(' ')[0] not in ALLOWED_PSYCOPG_VERSIONS:

No other changes to the versions definition would be required.

This will be both backwards and forwards compatible with all versions from 0.0.0 to 999.999.999 (well, infinity really)!

Keep up the good work.



Thomas O'Connor
Web developer

(02) 498 54130
Thomas.OConnor at newcastle.edu.au

Office of IT Services
Bar on the Hill Building
UoN Services Limited
University Drive
Callaghan NSW 2308

More information about the Zope mailing list