refine-client-py
refine-client-py copied to clipboard
Python 3.X changes using 2to3 lib
Fair warning, haven't tested this thoroughly so please review!
@joseboveda - have you run tests etc? Apologies for the extra late response...
test results for Python 3.7.3
- 2.0-java6: FAILED (errors=17)
- 2.5-java7: FAILED (errors=17)
- 3.2-java11: FAILED (errors=17)
two types of errors (for now):
- refine.py line 84:
urllib.request.urlopen(req)
Traceback (most recent call last):
File "/home/felix/Desktop/refine-client-py/tests/refinetest.py", line 39, in setUp
project_file=self.project_path(), project_format=self.project_format, **self.project_options)
File "/home/felix/Desktop/refine-client-py/google/refine/refine.py", line 273, in new_project
'create-project-from-upload', options, params
File "/home/felix/Desktop/refine-client-py/google/refine/refine.py", line 84, in urlopen
response = urllib.request.urlopen(req)
File "/usr/lib64/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib64/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/lib64/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib64/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib64/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib64/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.7/http/client.py", line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.7/http/client.py", line 1239, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.7/http/client.py", line 1064, in _send_output
+ b'\r\n'
TypeError: can't concat str to bytes
- refine.py line 93:
gzip_fp = gzip.GzipFile(fileobj=StringIO.StringIO(response.read())
Traceback (most recent call last):
File "/home/felix/Desktop/refine-client-py/tests/test_refine.py", line 31, in test_list_projects
projects = self.refine.list_projects()
File "/home/felix/Desktop/refine-client-py/google/refine/refine.py", line 140, in list_projects
return self.server.urlopen_json('get-all-project-metadata')['projects']
File "/home/felix/Desktop/refine-client-py/google/refine/refine.py", line 100, in urlopen_json
response = json.loads(self.urlopen(*args, **kwargs).read())
File "/home/felix/Desktop/refine-client-py/google/refine/refine.py", line 93, in urlopen
gzip_fp = gzip.GzipFile(fileobj=StringIO.StringIO(response.read()))
AttributeError: type object '_io.StringIO' has no attribute 'StringIO'