Forum Moderators: bakedjake

Message Too Old, No Replies

Python Code Help

takes no arguments (1 given)

         

stu_uk

4:08 pm on Oct 27, 2006 (gmt 0)

10+ Year Member



I'm having problems with python, its the first time i have used it an i keep getting the same error mesage. i don't understand what im doing wrong?

import urllib

import threading

from mechanize import Browser

class ImageGrabber(threading.Thread):

 def __init__(self,url,imgnum,searchterm):

  self.url=url

  self.imgnum=imgnum

  self.searchterm=searchterm

  threading.Thread.__init__(self)

 def run(self):

  urllib.urlretrieve(self.url,'test')

class ImageResults:

 def grabresults(query):

  br=Browser()

response=br.open('http://images.google.co.uk/images?hl=en&q=%s&btnG=Search'%(query))

  print response.read()

i=ImageResults()

i.grabresults('house')

When i try to run it i get the following error:

TypeError: grabresults() takes exactly 1 argument (2 given)

jezra

7:21 pm on Oct 27, 2006 (gmt 0)

10+ Year Member



try changing
def grabresults(query):
to
def grabresults(self,query):