Tuesday, June 24, 2008

Five 1.5.6 testbrowser and recent version of mechanize

Doing development with Plone 3.1, I encountered a KeyError when I tried to use Five.testbrowser.Browser:
Browser()
KeyError: '_seek'
I eventually found that my system (currently Ubuntu 8.04) had the package "python-mechanize" 0.1.7b, which masks the one provided by Zope 2.10 (0.1.2b). Unfortunatly there has been API changes between 0.1.2b and 0.1.7b... (see classes UserAgent/UserAgentBase)

The solution is to tell buildout to get mechanize egg 0.1.2b: this way it will mask the system library.
[buildout]
versions = versions
eggs=
...
mechanize

[versions]
mechanize = 0.1.2b
Et voila!

2 comments:

eserra said...

Hi, I'm getting crazy with a similar problem with functional tests in plain Zope3

I got Debian Lenny which has python-mechanize installed as a zope3 dependancy

I don't have buildout on my system

Could you give me a hint?

Alton said...

As you have experienced, I encountered a KeyError when I tried to use Five.testbrowser. It happens when I do development with Plone 3.1. Thankfully, I find solution here. It really helps me to solve the problem. Thanks.