Converting string to bytes

when I am trying to export a fit that I made for my data it tells me “a bytes-like object is required, not ‘str’”
I want to save the fitted data to a csv file but it wont let me