Python – jsonrpc import error

jsonrpc import error… here is a solution to the problem.

jsonrpc import error

I’m trying to follow this walkthrough how to use in jsonrpc ServiceProxy

I followed the instructions but got an error when importing ServiceProxy.

Here is the code I used:

#!usr/bin/python
import sys
import json
from jsonrpc import ServiceProxy

givex = jsonrpc. ServiceProxy()
print "foo"

This results in:

enter image description here

Can anyone help me with this, or suggest a better jsonrpc library to use.

Solution

The tutorial you are learning seems outdated. Try

from jsonrpc.proxy import JSONRPCProxy
givex = JSONRPCProxy.from_url("http://localhost/url/of/your/service.py")

Related Problems and Solutions