Open SajidSalim opened 7 years ago
The xmlrpclib module has been renamed to xmlrpc.client in Python 3.
This project has not been updated for two years, so you can find this file
jsonrpc.py and change
from xmlrpclib import Transport as XMLTransport
from xmlrpclib import SafeTransport as XMLSafeTransport
from xmlrpclib import ServerProxy as XMLServerProxy
from xmlrpclib import _Method as XML_Method
to
from xmlrpc.client import Transport as XMLTransport
from xmlrpc.client import SafeTransport as XMLSafeTransport
from xmlrpc.client import ServerProxy as XMLServerProxy
from xmlrpc.client import _Method as XML_Method
I am after the same thing. I've got it working in Python 3.5.2 (win10) with all tests passing, but have broken it for 2.7 (linux) which I'm looking into now. There's a bit more to the changes than those listed above.
You can use 2to3
to convert the source file:
2to3 -w jsonrpc.py
This will do the above for you. Then change manually these two lines:
line 168 from http.client import HTTP, HTTPConnection
line 186 class UnixHTTP(HTTP):
To
line 168 from http.client import HTTPConnection
line 186 class UnixHTTP(HTTPConnection):
The best option is however to switch to jsonrpclib-pelix which supports Python3
@SajidSalim / @tony-bony / @prs247au I know it is several years since you posted, but this should be resolved in 0.2.1 on PyPI for Python 3.5+. Please let me know if there are other issues (assuming you are still using something like this library), otherwise I will close the issue.
Can this library be supported to work for Python 3.x if certain issues are fixed? The following are the basic issues I have found. There are no compilation issues.
jsonrpc.py:
from xmlrpclib
becomesfrom xmlrpc.client
.from httplib import HTTP, HTTPConnection
becomesfrom http.client import HTTPConnection
SimpleJSONRPCServer.py:
SimpleXMLRPCServer
becomesxmlrpc.server
ServerSocket
becomesserversocket
Line 62:except Exception, e:
becomesexcept Exception as e:
Any other changes I am missing?