W Pythonie Dostaję błąd:AttributeError (" 'str' obiekt ma atrybut 'czytać'")
Exception: (<type 'exceptions.AttributeError'>,
AttributeError("'str' object has no attribute 'read'",), <traceback object at 0x1543ab8>)
danego kodu python:
def getEntries (self, sub):
url = 'http://www.reddit.com/'
if (sub != ''):
url += 'r/' + sub
request = urllib2.Request (url +
'.json', None, {'User-Agent' : 'Reddit desktop client by /user/RobinJ1995/'})
response = urllib2.urlopen (request)
jsonofabitch = response.read()
return json.load (jsonofabitch)['data']['children']
Co to oznacza błąd i co zrobiłem, aby to spowodować?
Podoba mi się nazwa zmiennej 'jsonofabitch'. –
Haha! Co to za "jsonofabitch"? : D – webmaster
Wygląda na to, że moderatorzy Stackoverflow mają poczucie humoru, na zmianę ... –