[twill] Debugging twill

sureshvv suresh_vv at yahoo.com
Wed Nov 23 01:00:29 PST 2005


Titus Brown wrote:
  ->
> -> I was able to make it work by patching _mech_open() method in _mechanize.py as 
> -> follows:
> -> 
> -> Around line 281, change
> -> 
> -> <       self._response = UserAgent.open(self, self.request, data)
> -> 
> -> to
> -> 
> ->  >       try:
> ->  >           self._response = UserAgent.open(self, self.request, data)
> ->  >       except urllib2.HTTPError, e:
> ->  >           self._response = e
> -> 
> 
> It makes me more interested than ever in what is happening in your case!
> If you look in 'utils.py', function 'journey', I do almost exactly the
> same thing.  I don't have a good idea of where your approach should
> differ the one in twill already... I'll have to look at the code with
> this in mind.

Yep... I copied it from there :)

Unfortunately it is too late in journey, since mechanize already thinks that 
there is an error and does not save the response in self._response. Later on, 
when you try to viewing_html(), it says Not viewing a page.

So the fix needs to be done at the mechanize level.

Suresh




More information about the twill mailing list