[twill] Using twill's builtin mechanize distribution throws AttributeError on _debug?

Stephen McInerney spmcinerney at hotmail.com
Sun Sep 4 14:31:36 PDT 2011


Hi Titus,

Can you look at that stacktrace though?
mechanize attempted to call robotparser._debug() which dos not exist (on this version anyway)
Is mechanize normally that flaky?
I guess I could kludge a dummy robotparser._debug(), but that seems bad.

Thanks,
Stephen


> Date: Sun, 4 Sep 2011 07:40:01 -0700
> From: ctb at msu.edu
> To: spmcinerney at hotmail.com
> CC: twill at lists.idyll.org
> Subject: Re: [twill] Using twill's builtin mechanize distribution throws	AttributeError on _debug?
> 
> Hi Stephen,
> 
> twill's built-in mechanize is rather old and out of date.  There should
> be little or no internal state kept by twill itself; it's a really thin
> wrapper around mechanize.  So you should be able to use it w/o any
> problem.
> 
> cheers,
> --titus
> 
> On Fri, Sep 02, 2011 at 12:45:38PM -0700, Stephen McInerney wrote:
> > 
> > twill experts,
> > 
> > I also posted this on StackOverflow, if you like to reply there:
> > http://stackoverflow.com/questions/7278103/using-twills-builtin-mechanize-distribution-throws-attributeerror-on-debug
> > 
> > Using twill's builtin mechanize distribution throws AttributeError on _debug?
> > 
> > I use twill (0.9) and I want to also access its builtin mechanize distribution (on Python 2.6.6).
> > I read all the documentation and I'm not clear whether they even support or recommend that, if so they certainly don't publicize it (you might like to document that).
> > It seems you can do:
> > 
> >     import _mechanize_dist as mechanize
> >     br = mechanize.Browser()
> >     br.open('http://www.yahoo.com')
> > 
> > however mechanize throws the stupid AttributeError below on `robotparser._debug`. Should I not be trying to use it? or is it a 2.5/2.6 incompatibility?
> > (Twill itself works fine: `twill.commands.go('http://www.yahoo.com')`)
> >     
> >     Traceback (most recent call last):
> >       File "<pyshell#19>", line 1, in <module>
> >         br.open('http://www.yahoo.com')
> >       File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_mechanize.py", line 212, in open
> >         return self._mech_open(url, data)
> >       File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_mechanize.py", line 238, in _mech_open
> >         response = UserAgentBase.open(self, request, data)
> >       File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_opener.py", line 175, in open
> >         req = meth(req)
> >       File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_http.py", line 440, in http_request
> >         self.rfp.read()
> >       File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_http.py", line 387, in read
> >         robotparser._debug("parse lines")
> >     AttributeError: 'module' object has no attribute '_debug'
> > 
> > (Last question is: I'm not aware of any caveats about using both twill and mechanize commands side-by-side?)
> > 
> > Thanks,
> > Stephen
> >  		 	   		  
> > _______________________________________________
> > twill mailing list
> > twill at lists.idyll.org
> > http://lists.idyll.org/listinfo/twill
> 
> 
> -- 
> C. Titus Brown, ctb at msu.edu
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/twill/attachments/20110904/9b63cac1/attachment.htm>


More information about the twill mailing list