View Single Post
Old Nov 20th, 2006, 2:36 AM   #11
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
I suggest you reconstruct the code bit by bit. I tried constructing a test program and it worked fine:
python Syntax (Toggle Plain Text)
  1. from urllib import urlopen
  2. from re import findall
  3. from urlparse import urljoin as basejoin
  4.  
  5. def next_page_finder(site):
  6. site = urlopen(site).read()
  7. next_site_pages = []
  8. next_site_pages.extend(findall(r'\?Brand=\d+\&pg=\d+',site))
  9. new_pages = []
  10. for _ in next_site_pages:
  11. new_pages.append(basejoin("http://www.goldwatches.com/watches.asp",_))
  12. return new_pages
  13.  
  14. print next_page_finder("http://www.goldwatches.com/watches.asp?Brand=11")
Test this program to see if it works on your system, then build up from it until you get your original program. Test it at each stage, and see what causes it to fail.

For instance, perhaps findall is redefined somewhere?
Arevos is offline   Reply With Quote