Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.X changes using 2to3 lib #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

joseboveda
Copy link

Fair warning, haven't tested this thoroughly so please review!

@paulmakepeace
Copy link
Owner

@joseboveda - have you run tests etc?
Apologies for the extra late response...

@felixlohmeier
Copy link

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):

  1. 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
  1. 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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants