python - (Pycharm mac os x) can't flush to file -
i want write file in real time(instead of waiting code finish) flushing, doesn't seem change anything. here's code:
datafile =open("json",'a+') def write(data): datafile.write(data) datafile.flush()
also datafile.close()
didn't change anything. know problem is?
edit: managed make work adding os.fsync(datafile.fileno())
right after datafile.flush()
you must use standard python library json https://docs.python.org/3.3/library/json.html
i think use of open file inside function global name not correct.
Comments
Post a Comment