python - Sometimes "PermissionError: [Errno 13]" in same code -
i'm using windows os. made function collects stock market data every second.
it works has error.
open(output_file, "at") fp: permissionerror: [errno 13] permission denied: 'output.csv'
the argument 'output_file' not folder name , file not open in window.
although error, 'data_bat' contents intact.
after error, next writing works well. (sometimes has error)
weird thing if has error, frequency of error increased.
what think problem?
def output_batch(output_file, data, data_bat, bat_size): data_seq = [58, 52, 46, 40, 34, 28, 22, 16, 10, 4, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55] data_bat.append(data) if len(data_bat) >= bat_size: open(output_file, "at") fp: in range(0, bat_size): fp.write((data_bat[i][0] + ",")) k in data_seq: fp.write((data_bat[i][k] + ",")) fp.write("\n,") k in data_seq: fp.write((data_bat[i][k + 1] + ",")) fp.write("\n,") k in data_seq: fp.write((data_bat[i][k + 2] + ",")) fp.write("\n") fp.close() del data_bat[:] # refresh list
any , comment appreciate me. thanks.
Comments
Post a Comment