This is the first time is used python i keep getting the same error message and i have no idea why: 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'%(self.query)) print response.read() i=ImageResults() i.grabresults('house') Code (markup): results it -> TypeError: grabresults() takes exactly 1 argument (2 given)
class ImageResults: def grabresults([B]self,[/B] query): br=Browser() response=br.open('http://images.google.co.uk/images?hl=en&q=%s&btnG=Search'%(self.query)) print response.read() Code (markup): In Python, you have to have this self parameter on the first place of every object method (it is equivalent C++ this).