Skip to content

Commit 177b208

Browse files
author
Alan Christie
committed
- StreamJsonListLoader now prints the characters it does not like
1 parent ccff356 commit 177b208

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/python/pipelines_utils/StreamJsonListLoader.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ def __init__(self, filename_or_stream):
3737
else:
3838
self.stream = filename_or_stream
3939

40-
if not self.stream.read(1) == '[':
41-
raise NotImplementedError('Only JSON-streams of lists (that start with a [) are supported.')
40+
stream_character = self.stream.read(1)
41+
if not stream_character == '[':
42+
raise NotImplementedError('Found "%s". Only JSON-streams of lists (that start with a "[") are supported.' % stream_character)
4243

4344
def __iter__(self):
4445
return self
@@ -49,8 +50,9 @@ def __next__(self):
4950
try:
5051
json_obj = json.loads(read_buffer)
5152

52-
if not self.stream.read(1) in [',',']']:
53-
raise Exception('JSON seems to be malformed: object is not followed by comma (,) or end of list (]).')
53+
stream_character = self.stream.read(1)
54+
if not stream_character in [',',']']:
55+
raise Exception('JSON seems to be malformed: object is not followed by comma (",") or end of list ("]"). Found "%s".' % stream_character)
5456
return json_obj
5557
except ValueError:
5658
next_char = self.stream.read(1)

src/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_long_description():
2222
setup(
2323

2424
name='im-pipelines-utils',
25-
version='2.4.3',
25+
version='2.4.4',
2626
author='Alan Christie',
2727
author_email='[email protected]',
2828
url='https://github.com/InformaticsMatters/pipelines-utils',

0 commit comments

Comments
 (0)