[twill] TypeError: Cannot create MRO

John Lee jjl at pobox.com
Wed Jan 10 13:38:00 PST 2007

On Wed, 10 Jan 2007, Michele Simionato wrote:
>> On Wed, Jan 03, 2007 at 04:37:44AM -0800, Sohrab Sepehri wrote:
>> -> TypeError: Error when calling the metaclass bases
>> ->     Cannot create a consistent method resolution
>> -> order (MRO) for bases response_seek_wrapper, httperror_seek_wrapper
> This is a rare error due to multiple inheritance conflicts (see
> http://www.python.org/download/releases/2.3/mro). It happens at class
> definition time.  Where is the class httperror_seek_wrapper? Could you
> provide module and line number? Which version of twill are you using?
> I don't find it in my twill installation.

It's in mechanize/_response.py, line 417 in SVN HEAD (of mechanize). 
Looks like twill 0.8.5 contains an older mechanize that does not contain 
that hack, so I guess the OP must have the darcs version (which I don't 

I am indeed playing some highly unpleasant tricks here.  Here's why:


An httperror_seek_wrapper class should be created every time you get a 
non-200 response, so for example opening a URL that does not exist should 
trigger this (unless twill does something funny here to suppress the 
error).  I don't seen the reported issue when I try this, though:

>>> br = mechanize.Browser()
>>> br.open("http://wwwsearch.sf.net/doesnotexist")
Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "/home/john/lib/python/mechanize/_mechanize.py", line 156, in open
      return self._mech_open(url, data)
    File "/home/john/lib/python/mechanize/_mechanize.py", line 207, in _mech_open
      raise response
mechanize._response.httperror_seek_wrapper: HTTP Error 404: Not Found

Do you see what the problem is, Michele?  If you can suggest a way out of 
this mess without changing public interfaces, that would be even better 


More information about the twill mailing list