Try/catch to skip invalid JSON in dirtyDB

This commit is contained in:
Achim Friedland 2018-11-02 20:10:36 +01:00 committed by muxator
parent 0443de4dc9
commit 5f836f6211

View file

@ -31,8 +31,11 @@ with open(dirtydb_input, 'r') as fd:
print 'Reading %s' % dirtydb_input
for line in fd:
lines += 1
data = json.loads(line)
dirtydb[data['key']] = line
try:
data = json.loads(line)
dirtydb[data['key']] = line
except:
print("Skipping invalid JSON!")
if lines % 10000 == 0:
sys.stderr.write('.')
print