[Tutor] is this a vista issue
Hi when I run this code on a winxp box I get a nice list of url's when I run this code on a win VISTA box I get this print urlparse.urlparse(href)[1]TypeError: 'module' object is not callable can a. someone tell me why b. how do i get rid of this condition before I throw vista away :) Many thanks in advance S [CODE] from BeautifulSoup import BeautifulSoupdoc = ['htmlheadtitlePage title/title/head', 'bodyp id=firstpara align=centerThis is paragraph bone/b.', 'p id=secondpara align=blahThis is paragraph btwo/b.', 'a href=http://www.google.co.uk;/a', 'a href=http://www.bbc.co.uk;/a', 'a href=http://www.amazon.co.uk;/a', 'a href=http://www.redhat.co.uk;/a', '/html']soup = BeautifulSoup(''.join(doc))blist = soup.findAll('a')print blist import urlparsefor a in blist:href = a['href']print urlparse.urlparse(href)[1] [/CODE] _ Get free emoticon packs and customisation from Windows Live. http://www.pimpmylive.co.uk___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] is this a vista issue
sacha rook wrote: Hi when I run this code on a winxp box I get a nice list of url's when I run this code on a win VISTA box I get this print urlparse.urlparse(href)[1] TypeError: 'module' object is not callable Please show the whole traceback. Kent can a. someone tell me why b. how do i get rid of this condition before I throw vista away :) Many thanks in advance S [CODE] from BeautifulSoup import BeautifulSoup doc = ['htmlheadtitlePage title/title/head', 'bodyp id=firstpara align=centerThis is paragraph bone/b.', 'p id=secondpara align=blahThis is paragraph btwo/b.', 'a href=http://www.google.co.uk;/a' http://www.google.co.uk;/a', 'a href=http://www.bbc.co.uk;/a' http://www.bbc.co.uk;/a', 'a href=http://www.amazon.co.uk;/a' http://www.amazon.co.uk;/a', 'a href=http://www.redhat.co.uk;/a' http://www.redhat.co.uk;/a', '/html'] soup = BeautifulSoup(''.join(doc)) blist = soup.findAll('a') print blist import urlparse for a in blist: href = a['href'] print urlparse.urlparse(href)[1] [/CODE] Are you the Quizmaster? Play BrainBattle with a friend now! http://specials.uk.msn.com/brainbattle ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] is this a vista issue
On 13/09/2007, sacha rook [EMAIL PROTECTED] wrote: [CODE] from BeautifulSoup import BeautifulSoup doc = ['htmlheadtitlePage title/title/head', 'bodyp id=firstpara align=centerThis is paragraph bone/b.', 'p id=secondpara align=blahThis is paragraph btwo/b.', 'a href=http://www.google.co.uk;/a', 'a href=http://www.bbc.co.uk;/a', 'a href=http://www.amazon.co.uk;/a', 'a href=http://www.redhat.co.uk;/a', '/html'] soup = BeautifulSoup(''.join(doc)) blist = soup.findAll('a') print blist import urlparse for a in blist: href = a['href'] print urlparse.urlparse(href)[1] [/CODE] Works fine for me: ## working on region in file python-tmp-371673F... [a href=http://www.google.co.uk;/a, a href=http://www.bbc.co.uk;/a, a href=http://www.amazon.co.uk;/a, a href=http://www.redhat.co.uk;/a] www.google.co.uk www.bbc.co.uk www.amazon.co.uk www.redhat.co.uk But as Kent wrote; show the whole traceback, not just the last line. -- - Rikard - http://bos.hack.org/cv/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor