hanglearning / VBFL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

io.UnsupportedOperation: not readable

Hongchenglong opened this issue · comments

If no valid block has been generated this round, the following error will occur:

No valid block has been generated this round.
Traceback (most recent call last):
  File "/content/drive/My Drive/VBFL/main.py", line 837, in <module>
    slowest_round_ends_time = max(all_devices_round_ends_time)
ValueError: max() arg is an empty sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/content/drive/My Drive/VBFL/main.py", line 844, in <module>
    if file2.readlines()[-1] != no_valid_block_msg:
io.UnsupportedOperation: not readable

Because 'a' means apend, it has no permission to read, it should be 'r+'.

with open(f"{log_files_folder_path}/forking_and_no_valid_block_log.txt", 'a') as file2:
	no_valid_block_msg = f"No valid block in round {comm_round}\n"
	if file2.readlines()[-1] != no_valid_block_msg:
		file2.write(no_valid_block_msg)

This is my fix #14.

Oh cool, thanks for your continuous effort!