0

This example exits, printing:

{"id": null, "error": {"message": "Parse error", "code": -32700}}

When run from command line or as a CGI executable from Apache. It gets this parse error before any data is sent to it at all. Somethings' not right.

The example given in the source code for jsonrpc seems to only work because it uses Python's provided HTTPserver. I need to run under apache.

This example is supposed to run from the command line, even typed into the Python prompt. I don't know what problem it's having or why it exits. It should set up a service and wait.

Code:

#!/usr/bin/env python
from jsonrpc import handleCGI, ServiceMethod

@ServiceMethod
def echo(msg):
    return msg

if __name__ == "__main__":
    handleCGI()
hammar
  • 138,522
  • 17
  • 304
  • 385
Eiríkur
  • 1
  • 2
  • There are multiple libraries named `jsonrpc`, none of which is part of the standard lib (at least as of 2.7 or 3.3). So you'll have to tell us which one you're using and how you installed it before anyone can help you. – abarnert Oct 22 '12 at 21:08
  • 1
    Also, even without knowing which library you're using, it seems pretty obvious that when run from the command line this should act like a CGI: respond to a single request from stdin on stdout and then quit. Presumably there's a `handleServer(80)` method or something if you want it to actually start its own webserver… – abarnert Oct 22 '12 at 21:12

0 Answers0