Skip to content

Conversation

@brahmlower
Copy link
Contributor

While calling methods.serve_forever() (using Python 2.7.12), I was receiving the error "TypeError: 'module' object is not callable". This issue can be replicated by running the built-in example on the examples page.

>>> from jsonrpcserver import Methods >>> methods = Methods() >>> @methods.add ... def ping(): ... return "pong" ... >>> methods.serve_forever() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/jsonrpcserver/http_server.py", line 42, in serve_forever httpd = HTTPServer((name, port), RequestHandler)

This is because jsonrpcserver.http_server is importing HTTPServer from SimpleHTTPServer which results in HTTPServer being a module rather than a class. This now imports from BaseHTTPServer. Running the example again with this change results in the http server running as expected.

>>> from jsonrpcserver import Methods >>> methods = Methods() >>> @methods.add ... def ping(): ... return "pong" ... >>> methods.serve_forever() * Listening on port 5000
While calling methods.serve_forever() (using Python 2), I was receiving the error "TypeError: 'module' object is not callable". This is because jsonrpcserver.http_server is importing HTTPServer from SimpleHTTPServer rather than BaseHTTPServer, which results in HTTPServer being a module rather than a class. This now imports from BaseHTTPServer.
@bcb bcb merged commit 2019cd1 into explodinglabs:master Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants