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

incomplete iteration when given list containing empty strings #30

wbolster opened this Issue Jul 18, 2017 · 0 comments


None yet
1 participant

wbolster commented Jul 18, 2017

>>> import jsonlines

>>> list(jsonlines.Reader(['123', '456', '', '789']))
[123, 456]

this should raise an error instead since '' is not a valid json value, and skip_empty defaults to False.

for normal files it works as expected:

>>> list(jsonlines.Reader(io.StringIO('123\n456\n\n789')))
Traceback (most recent call last):
InvalidLineError: line contains invalid json: Expecting value: line 2 column 1 (char 1) (line 3)

>>> list(jsonlines.Reader(io.StringIO('123\n456\n\n789')).iter(skip_empty=True))
[123, 456, 789]

@wbolster wbolster added the bug label Jul 18, 2017

@wbolster wbolster self-assigned this Jul 18, 2017

@wbolster wbolster changed the title from imcomplete iteration when given list containint empty strings to incomplete iteration when given list containing empty strings Jul 18, 2017

@wbolster wbolster closed this in 7b2c038 Jul 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment