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

Stephen McInerney spmcinerney at hotmail.com
Fri Sep 2 12:45:38 PDT 2011


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
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/twill/attachments/20110902/efbd1eee/attachment.htm>


More information about the twill mailing list