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

srsly.read_json is broken #29

Closed
tamuhey opened this issue Jul 3, 2020 · 2 comments
Closed

srsly.read_json is broken #29

tamuhey opened this issue Jul 3, 2020 · 2 comments

Comments

@tamuhey
Copy link

tamuhey commented Jul 3, 2020

code:

import srsly

print(srsly.read_json("foo.json"))

outputs:

Traceback (most recent call last):
  File "/tmp/foo.py", line 4, in <module>
    print(srsly.read_json("foo.json"))
  File "/Users/yohei_tamura/work/lilly/.venv/lib/python3.8/site-packages/srsly/_json_api.py", line 52, in read_json
    return ujson.load(f)
ValueError: Expected object or value

srsly version: 2.2.0
python version: 3.8.1

@ines
Copy link
Member

ines commented Jul 3, 2020

It looks like the problem happens in ujson when it's trying to load the opened file.

In the code in your traceback, you're reading from sys.argv[0] – are you sure that points to the correct file? And that the file isn't empty and contains JSON-loadable content etc.?

@tamuhey
Copy link
Author

tamuhey commented Jul 3, 2020

This problem is caused because the content of my json file is broken, I'm sorry

@tamuhey tamuhey closed this as completed Jul 3, 2020
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

2 participants