Reputation: 443
I previously had Python 2.7 installed and was making calls like this:
api = jsonrpclib.Server('my host')
api.someFunctionCall()
I then upgraded to Python 3.5.2 and now when I run the code above, I'm receiving this message:
Traceback (most recent call last):
File "C:\login\login.py", line 1, in <module>
import jsonrpclib
File "C:\Python3.5.2\lib\site-packages\jsonrpclib\__init__.py", line 5, in <module>
from jsonrpclib.jsonrpc import Server, MultiCall, Fault
ImportError: No module named 'xmlrpclib'
I checked my installation and I do indeed have the xmlrpc lib:
c:\Python3.5.2\Lib\xmlrpc
What am I doing wrong?
Upvotes: 3
Views: 3508
Reputation: 56
Python 3.x has relocated the xmlrpclib module. Per the Python 2.7 xmlrpclib documentation:
"The xmlrpclib module has been renamed to xmlrpc.client in Python 3. The 2to3 tool will automatically adapt imports when converting your sources to Python 3."
It looks like the author of jsonrpclib has an open issue for Python 3 support, but hasn't responded or taken pull requests in a year. You may want to give the jsonrpclib-pelix fork a look for Python 3 support.
Upvotes: 4