Skip to content
Snippets Groups Projects
Commit c69f5a2d authored by Berk Onat's avatar Berk Onat
Browse files

json.dump fails for python3 with Broken Pipe Error for IO buffer due to ....

json.dump fails for python3 with Broken Pipe Error for IO buffer due to . Trying to fix it with stdout.flush().
parent 5baefb9b
Branches
Tags
No related merge requests found
...@@ -97,6 +97,8 @@ class JsonParseEventsWriterBackend(object): ...@@ -97,6 +97,8 @@ class JsonParseEventsWriterBackend(object):
self.fileOut.write(", ") self.fileOut.write(", ")
else: else:
self.__writeComma = True self.__writeComma = True
self.fileOut.flush() # Python3 uses buffer for IO operations.
# Need to flush the buffer before accessing the content at json.dump
json.dump(dic, self.fileOut, indent = 2, separators = (',', ':'), sort_keys=True) # default = self.__numpyEncoder) json.dump(dic, self.fileOut, indent = 2, separators = (',', ':'), sort_keys=True) # default = self.__numpyEncoder)
def startedParsingSession(self, mainFileUri, parserInfo, parserStatus = None, parserErrors = None): def startedParsingSession(self, mainFileUri, parserInfo, parserStatus = None, parserErrors = None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment