title: simple web crawler
body: <p>i wrote below program in python for very simple web crawler, but when i run it it return me 
  'NoneType' object is not callable' , could you please help me?</p>
  
  <pre><code>import BeautifulSoup
  import urllib2
  def union(p,q):
      for e in q:
          if e not in p:
              p.append(e)
  
  def crawler(SeedUrl):
      tocrawl=[SeedUrl]
      crawled=[]
      while tocrawl:
          page=tocrawl.pop()
          pagesource=urllib2.urlopen(page)
          s=pagesource.read()
          soup=BeautifulSoup.BeautifulSoup(s)
          links=soup('a')        
          if page not in crawled:
              union(tocrawl,links)
              crawled.append(page)
  
      return crawled
  crawler('http://www.princeton.edu/main/')
  </code></pre>