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

Streaming json instead of loading whole object to memory. #3

Open
noway opened this issue Jun 2, 2014 · 4 comments
Open

Streaming json instead of loading whole object to memory. #3

noway opened this issue Jun 2, 2014 · 4 comments

Comments

@noway
Copy link
Collaborator

noway commented Jun 2, 2014

Not always stdin give you all data instantly. So instead of waiting EOF, would be better to process json instantly.
Some implementations of json readers with stream support:
https://github.com/dominictarr/JSONStream
https://pykler.github.io/yajl-py/
https://github.com/rtyler/py-yajl/

@amarao
Copy link
Owner

amarao commented Jun 2, 2014

Thanks, I'll look to it.

@amarao
Copy link
Owner

amarao commented Jun 16, 2014

I've checked JSONStream. May be I doing something wrong, but it does not process generator input until it done. Means it can't parse incoming stream. Failed attemt here: https://github.com/amarao/json4shell/tree/jsonstream/tools

@noway
Copy link
Collaborator Author

noway commented Jun 17, 2014

sys.stdout.flush() was the case. Also, appears that sys.stdin is not iterable in python2.
I fixed it and it's working now.
JSONSream is really nice choice, by the way. It doesn't require compilation, and it's written in pure python. Though it can be compiled as native python module (through cython), python version works fine. It can be even included directly in git repo! So there would be no need to do some extra deploy work while installing json4shell.

@amarao
Copy link
Owner

amarao commented Jun 17, 2014

Thanks!

I'll recheck it again.

On 06/17/2014 04:49 PM, Way, No wrote:

|sys.stdout.flush()| was the case. Also, appears that sys.stdin is not
iterable in python2.
I fixed it and it's working now.
JSONSream is really nice choice, by the way. It doesn't require
compilation, and it's written in pure python. Though it can be
compiled as native python module (through cython), python version
works fine. It can be even included directly in git repo! So there
would be no need to do some extra deploy work while installing json4shell.


Reply to this email directly or view it on GitHub
#3 (comment).

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