<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Ok, but do I worry about fixing that by installing a newer mechanize<br>(or is that even possible without breaking twill?)<br>Or do I just accept errors like that as a fact of life?<br><br><div>> Date: Sun, 4 Sep 2011 22:47:03 +0100<br>> From: jjl@pobox.com<br>> To: twill@lists.idyll.org<br>> CC: spmcinerney@hotmail.com<br>> Subject: Re: [twill] Using twill's builtin mechanize distribution throws AttributeError on _debug?<br>> <br>> That line hasn't been there in mechanize since 2008 -- back then it knew <br>> much more about Python than it does now. I'd guess that code worked with <br>> versions of Python that had been released at that time. Now it's based on <br>> a fork of urllib2, so is less fragile to changes in Python.<br>> <br>> I guess neither of us (me nor Titus) spend much time on this stuff these <br>> days. Certainly mechanize is not dead but certainly resting pretty hard <br>> -- but still, it's seen a fair amount of change since 2008. Speaking for <br>> myself more than Titus of course...<br>> <br>> <br>> John<br>> <br>> On Sun, 4 Sep 2011, Stephen McInerney wrote:<br>> <br>> ><br>> > Hi Titus,<br>> ><br>> > Can you look at that stacktrace though?<br>> > mechanize attempted to call robotparser._debug() which dos not exist (on this version anyway)<br>> > Is mechanize normally that flaky?<br>> > I guess I could kludge a dummy robotparser._debug(), but that seems bad.<br>> ><br>> > Thanks,<br>> > Stephen<br>> ><br>> ><br>> >> Date: Sun, 4 Sep 2011 07:40:01 -0700<br>> >> From: ctb@msu.edu<br>> >> To: spmcinerney@hotmail.com<br>> >> CC: twill@lists.idyll.org<br>> >> Subject: Re: [twill] Using twill's builtin mechanize distribution throws        AttributeError on _debug?<br>> >><br>> >> Hi Stephen,<br>> >><br>> >> twill's built-in mechanize is rather old and out of date. There should<br>> >> be little or no internal state kept by twill itself; it's a really thin<br>> >> wrapper around mechanize. So you should be able to use it w/o any<br>> >> problem.<br>> >><br>> >> cheers,<br>> >> --titus<br>> >><br>> >> On Fri, Sep 02, 2011 at 12:45:38PM -0700, Stephen McInerney wrote:<br>> >>><br>> >>> twill experts,<br>> >>><br>> >>> I also posted this on StackOverflow, if you like to reply there:<br>> >>> http://stackoverflow.com/questions/7278103/using-twills-builtin-mechanize-distribution-throws-attributeerror-on-debug<br>> >>><br>> >>> Using twill's builtin mechanize distribution throws AttributeError on _debug?<br>> >>><br>> >>> I use twill (0.9) and I want to also access its builtin mechanize distribution (on Python 2.6.6).<br>> >>> 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).<br>> >>> It seems you can do:<br>> >>><br>> >>> import _mechanize_dist as mechanize<br>> >>> br = mechanize.Browser()<br>> >>> br.open('http://www.yahoo.com')<br>> >>><br>> >>> 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?<br>> >>> (Twill itself works fine: `twill.commands.go('http://www.yahoo.com')`)<br>> >>><br>> >>> Traceback (most recent call last):<br>> >>> File "<pyshell#19>", line 1, in <module><br>> >>> br.open('http://www.yahoo.com')<br>> >>> File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_mechanize.py", line 212, in open<br>> >>> return self._mech_open(url, data)<br>> >>> 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<br>> >>> response = UserAgentBase.open(self, request, data)<br>> >>> File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_opener.py", line 175, in open<br>> >>> req = meth(req)<br>> >>> 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<br>> >>> self.rfp.read()<br>> >>> File "C:\Dev\Python26\lib\site-packages\twill-0.9-py2.6.egg\twill\other_packages\_mechanize_dist\_http.py", line 387, in read<br>> >>> robotparser._debug("parse lines")<br>> >>> AttributeError: 'module' object has no attribute '_debug'<br>> >>><br>> >>> (Last question is: I'm not aware of any caveats about using both twill and mechanize commands side-by-side?)<br>> >>><br>> >>> Thanks,<br>> >>> Stephen<br>> >>><br>> >>> _______________________________________________<br>> >>> twill mailing list<br>> >>> twill@lists.idyll.org<br>> >>> http://lists.idyll.org/listinfo/twill<br>> >><br>> >><br>> >> --<br>> >> C. Titus Brown, ctb@msu.edu<br>> ><br></div>                                            </div></body>
</html>