B-M
B-M

Reputation: 1288

ImportError for jsonrpc

I am trying to follow this walkthrough on how to use the ServiceProxy in jsonrpc.

I followed the directions but I am getting an error no the import of the ServiceProxy.

Here is the code I am using:

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

givex = jsonrpc.ServiceProxy()
print "foo"

which is resulting in:

enter image description here

Would anyone be able to help me out with some ideas on how to fix this, or have a suggestion for a better jsonrpc library to use.

Upvotes: 3

Views: 4498

Answers (2)

e18r
e18r

Reputation: 8161

If you are trying to run this under Python 3.x, bear in mind that it is not yet supported. Many JSON RPC libraries have very similar names, but this particular one (jsonrpc without the dash, different from json-rpc or jsonrpc2) does not support Python 3 as of december 2016.

Here is the link for this particular library: https://pypi.python.org/pypi/jsonrpc

Upvotes: 1

Bartosz Marcinkowski
Bartosz Marcinkowski

Reputation: 6861

The tutoral you are following seems to be outdated. Try

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

Upvotes: 3

Related Questions