1

The following code, taken from https://www.thoughtco.com/using-pickle-to-save-objects-2813661, throws TypeError: write() argument must be str, not bytes

I am using Ubuntu 21.04, python 3.9.5, and it may well be the case that I have screwed something up in my python install, but I have no idea how I should go about solving the problem.

import pickle 
import math 
object_pi = math.pi 
file_pi = open('filename_pi.obj', 'w') 
pickle.dump(object_pi, file_pi)
Daniel
  • 175
  • 6

0 Answers0