You need to open the file for reading in order to use .read()
You have only opened it for writing with "wb"
.
Use "rb"
to read, "wb"
to write, and "ab"
to append
adding a '+'
like "ab+"
allows for simulaneous reading and appending/writing
There is a reference for the different modes here
Example:
with open("filepath/file.ext", "ab+") as fo:
old = fo.read() # this auto closes the file after reading, which is a good practice
fo.write("something") # to the end of the file