Package: python-beautifulsoup
Version: 3.0.1-2

I have a python program failing for me on Debian stable (etch), this program 
works on non-debian systems (well, Gentoo at least).

I have traced the problem to the beautifulsoup find method which is providing 
output when it should return None.  Interestingly findAll seems to do the 
right thing.

Consider the following example program (sorry for the wraps):

############################################
#!/usr/bin/env python

import urllib2
from cookielib import CookieJar, DefaultCookiePolicy
from BeautifulSoup import BeautifulSoup

def setup():
        cpol = 
DefaultCookiePolicy(allowed_domains=("google.com", ".google.com"))
        cjar = CookieJar(cpol)
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cjar))
        opener.addheaders = [("User-agent", "Mozilla/5.0 (compatible; 
Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko)")]
        urllib2.install_opener(opener)

def getpage(url="http://www.google.com";, data=None):
        req = urllib2.Request(url)
        page = urllib2.urlopen(req, data)
        return BeautifulSoup(page)

def main():
        setup()
        s = getpage()
        print s.find("img", src="notanimage")
        print s.findAll("img", src="notanimage")

if __name__ == "__main__":
        main()
############################################

When run it should print:
None
[]

However on my Debian system it prints:
<img alt="Google" height="110" src="/intl/en_uk/images/logo.gif" 
width="276" />
[]

I have confirmed that the correct output is given on my Gentoo system.
-- 
Geoff


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to