[twill] BeautifulSoup conflicts

twill.overbored at spamgourmet.com twill.overbored at spamgourmet.com
Sat Aug 5 20:44:44 PDT 2006


I just tried with twill 0.8.5 (BeautifulSoup still at 3.0.3) and this
is no longer a problem. Did someone fix it? (Thanks!)

On 7/3/06, I wrote:
> The program (/tmp/zxcv):
>
> import BeautifulSoup
> import twill.commands
> twill.commands.go('http://youtube.com/')
> twill.commands.follow( 'Log In' )
>
> The output and exception:
>
> ==> at http://youtube.com/
> Traceback (most recent call last):
>   File "/tmp/zxcv", line 6, in ?
>     twill.commands.follow( 'Log In' )
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/commands.py",
> line 180, in follow
>     link = browser.find_link(regexp)
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/browser.py",
> line 181, in find_link
>     l = self._browser.find_link(url_regex=pattern)
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/mechanize/_mechanize.py",
> line 431, in find_link
>     return _find_links(self._factory.links(), True, **kwds)
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/utils.py",
> line 382, in links
>     self._links = list(self._links)
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/mechanize/_html.py",
> line 345, in links
>     bs = self.link_parser_class(encoding, data)
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/mechanize/_html.py",
> line 303, in __init__
>     BeautifulSoup.BeautifulSoup.__init__(
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/BeautifulSoup.py",
> line 1326, in __init__
>
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/BeautifulSoup.py",
> line 973, in __init__
>
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/BeautifulSoup.py",
> line 987, in _feed
>
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/BeautifulSoup.py",
> line 1580, in __init__
>
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/BeautifulSoup.py",
> line 1614, in _convertFrom
>
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/BeautifulSoup.py",
> line 1731, in find_codec
>
>   File "/usr/lib/python2.4/site-packages/twill-0.8.4-py2.4.egg/twill/other_packages/BeautifulSoup.py",
> line 1740, in _codec
>
> TypeError: lookup() argument 1 must be string, not bool
>
> On 7/2/06, William K. Volkman - wkvsf at users.sourceforge.net
> <>
> wrote:
> > Hello,
> > On Sun, 2006-07-02 at 21:20, twill.overbored at spamgourmet.com wrote:
> > > On 7/2/06, William K. Volkman - wkvsf at users.sourceforge.net
> > > <>
> > > wrote:
> > > > On Sun, 2006-07-02 at 18:11, twill.overbored at spamgourmet.com wrote:
> > > > > I'm trying to use both twill and BeautifulSoup. I downloaded the
> > > > > latest BeautifulSoup (3.0.3) and have the following simple program:
> > > > >
> > > > > from BeautifulSoup import BeautifulSoup
> > > >
> > > > I suspect you're stepping on twill's desire to use BeautifulSoup,
> > > > the quick and dirty solution solution would be:
> > > >
> > > > from BeautifulSoup import BeautifulSoup as MySoup
> > >
> > > I had already tried this, but it still doesn't work; there's something
> > > more intricate going on.
> >
> > OK.
> >
> > > The problem is that I'm trying to use code which seems to only work
> > > with bsoup 3.x.
> > >
> > > >
> > > > > from twill.commands import *
> > > > > from twill.errors import *
> > > > > from twill import *
> > > > > from sys import *
> > > > > go('http://youtube.com/')
> > > > > follow( 'Log In' )
> > > > >
> > > > > This raises a hard-to-decipher exception. Once I remove the
> > > > > BeautifulSoup improt, everything's fine. Should this be filed as a
> > > > > twill bug? Any workarounds in the meantime? Thanks in advance.
> >
> > Well perhaps you could share the trace back from the hard-to-decipher
> > exception?  (making it a little less hard to decipher :-D)
> >
> > Cheers,
> > William.
> >
> >
> >
>



More information about the twill mailing list