Skip to content

TypeError: sequence item 0: expected str instance, bytes found #135

@erickoledadevrel

Description

@erickoledadevrel

Getting the following error in Python 3.4:

Traceback (most recent call last):
File "gmail.py", line 71, in
main()
File "gmail.py", line 59, in main
results = service.users().labels().list(userId='me').execute()
File "/usr/local/lib/python3.4/dist-packages/oauth2client/util.py", line 142, in positional_wrapper
return wrapped(_args, *_kwargs)
File "/usr/local/lib/python3.4/dist-packages/googleapiclient/http.py", line 722, in execute
body=self.body, headers=self.headers)
File "/usr/local/lib/python3.4/dist-packages/oauth2client/client.py", line 589, in new_request
redirections, connection_type)
File "/usr/lib/python3/dist-packages/httplib2/init.py", line 1120, in request
headers = self._normalize_headers(headers)
File "/usr/lib/python3/dist-packages/httplib2/init.py", line 1088, in _normalize_headers
return _normalize_headers(headers)
File "/usr/lib/python3/dist-packages/httplib2/init.py", line 194, in _normalize_headers
return dict([ (key.lower(), NORMALIZE_SPACE.sub(value, ' ').strip()) for (key, value) in headers.items()])
File "/usr/lib/python3/dist-packages/httplib2/init.py", line 194, in
return dict([ (key.lower(), NORMALIZE_SPACE.sub(value, ' ').strip()) for (key, value) in headers.items()])
TypeError: sequence item 0: expected str instance, bytes found

This was determined to be a bug in httplib2, and fixed by:

jcgregorio/httplib2#291

Although oauth2client has been updated to depend on the latest httplib2 (0.9.1), google-api-python-client still depends on httplib2>=0.8 and oauth2client>=1.4.6, and hence a naive install of the library will not include that fix.

To fix this issue either http2lib or oauth2client (or both) should be updated to use newer versions.

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions