Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81848 > unrolled thread

Re: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'>

Started byChris Angelico <rosuav@gmail.com>
First post2014-12-03 20:42 +1100
Last post2014-12-03 20:42 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'> Chris Angelico <rosuav@gmail.com> - 2014-12-03 20:42 +1100

#81848 — Re: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'>

FromChris Angelico <rosuav@gmail.com>
Date2014-12-03 20:42 +1100
SubjectRe: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'>
Message-ID<mailman.16523.1417599762.18130.python-list@python.org>
On Tue, Dec 2, 2014 at 6:45 AM, Chris Cioffi <chris@evenprimes.com> wrote:
>   File "/Users/chris/dev/LendingClub/lendingclub.py", line 40, in _make_api_call
>     pprint(lcresponse.read())
> TypeError: 'module' object is not callable
>
> The relevant code is as follows:
> lcrequest = urllib.request.Request(url, data, {"Authorization": authorizationKey})
> lcresponse = urllib.request.urlopen(lcrequest)
>
> Any ideas on what I should be looking for?  Based on the docs and examples I would expect this to work.

Your problem isn't with urllib, but with pprint. The pprint module
exposes a function called pprint; you can use it either like this:

from pprint import pprint
pprint(some_object)

Or like this:

import pprint
pprint.pprint(some_object)

It looks like you're mixing and matching the two forms.

All the best!

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web