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

TypeError: b'coveralls' is not JSON serializable #56

Open
josephharrington opened this issue Dec 24, 2016 · 0 comments
Open

TypeError: b'coveralls' is not JSON serializable #56

josephharrington opened this issue Dec 24, 2016 · 0 comments

Comments

@josephharrington
Copy link
Contributor

Full stack trace is below. It looks like the recent change to add Windows support may have missed a universal_newlines=True parameter in the check_output call to get a git branch name.

I'm not sure why this wouldn't be caught on TravisCI. The tests fail for me locally with this error on both OS X and Linux, in Python 3.3.2 and 3.3.6.

$ coveralls --coveralls_url=https://10.228.98.37
Traceback (most recent call last):
  File "/Users/jharrington/.pyenv/versions/rosie-hooks/bin/coveralls", line 11, in <module>
    sys.exit(wear())
  File "/Users/jharrington/.pyenv/versions/3.3.2/envs/rosie-hooks/lib/python3.3/site-packages/coveralls/__init__.py", line 95, in wear
    parallel=args.parallel,
  File "/Users/jharrington/.pyenv/versions/3.3.2/envs/rosie-hooks/lib/python3.3/site-packages/coveralls/api.py", line 7, in post
    json_file = build_file(repo_token, service_job_id, service_name, git, source_files, parallel)
  File "/Users/jharrington/.pyenv/versions/3.3.2/envs/rosie-hooks/lib/python3.3/site-packages/coveralls/api.py", line 22, in build_file
    return StringIO(json.dumps(content))
  File "/Users/jharrington/.pyenv/versions/3.3.2/lib/python3.3/json/__init__.py", line 236, in dumps
    return _default_encoder.encode(obj)
  File "/Users/jharrington/.pyenv/versions/3.3.2/lib/python3.3/json/encoder.py", line 191, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Users/jharrington/.pyenv/versions/3.3.2/lib/python3.3/json/encoder.py", line 249, in iterencode
    return _iterencode(o, 0)
  File "/Users/jharrington/.pyenv/versions/3.3.2/lib/python3.3/json/encoder.py", line 173, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'coveralls' is not JSON serializable
josephharrington added a commit to josephharrington/python-coveralls that referenced this issue Dec 24, 2016
Previous code in repository.py got the current git branch name by
doing a `check_output` call without the universal_newlines flag, so
it returned a byte string. Later when the request is made to
coveralls API with the branch name, the JSON encode fails with a
TypeError on the byte string.

I'm not sure why this isn't broken on TravisCI, but I'd guess it's
related to some language/encoding env vars.

Fixes z4r#56.
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

No branches or pull requests

1 participant