Python TypeError: coercing to Unicode: need string or buffer, NoneType found


Where train_accuracy_top5_nbatch_filename is the name of the file, and the code is as shown in the assignment

train_accuracy_top5_nbatch_filename = "a" + "b" + "c" + ".log"

But in execution

train_accuracy_top5_nbatch_file_op = open(train_accuracy_top5_nbatch_filename, "a")

An error occurred when.
Solutions:

train_accuracy_top5_nbatch_file_op = open(str(train_accuracy_top5_nbatch_filename), "a")

 

Read More: