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

Error Json(path="object.json") : AttributeError: 'str' object has no attribute 'read' #21

Open
limsan opened this issue Nov 4, 2017 · 2 comments

Comments

@limsan
Copy link

limsan commented Nov 4, 2017

Traceback (most recent call last):
File "testNameTupled.py", line 6, in
vals = namedtupled.json(path="object.json")
File "C:\Users\PERKASA\AppData\Local\conda\conda\envs\python2\lib\site-packages\namedtupled\integrations.py", line 19, in load_json
return mapper(json.load(path), nt_name=name)
File "C:\Users\PERKASA\AppData\Local\conda\conda\envs\python2\lib\json_init
.py", line 287, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'

@jonseymour
Copy link

jonseymour commented Nov 8, 2017

@limsan the confusion, I think, is that the path parameter (in the definition of namedtupled.json) is misnamed. In practice, it is actually meant to be file-like argument of the same type expected by json.load() rather than the name of file as per your (reasonable) expectation.

@brennv
Copy link
Owner

brennv commented Feb 14, 2018

Looking back at this again, sorry I'm still thinking about the best way forward

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

3 participants