Python Forum
TypeError: file must have 'read' and 'readline' attributes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: file must have 'read' and 'readline' attributes
#7
(Jun-12-2020, 05:05 PM)hobbyist Wrote: Any idea?
It seems pickle.load() is for use when unpickling. If you are trying to pickle an image, you want to use pickle.dumps() which returns a pickled object.
If you want to save the pickled object to a file, you could use pickle.dump(f, open("myfile.data", "wb"))
Reply


Messages In This Thread
RE: TypeError: file must have 'read' and 'readline' attributes - by DreamingInsanity - Jun-12-2020, 05:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Recommended way to read/create PDF file? Winfried 3 2,905 Nov-26-2023, 07:51 AM
Last Post: Pedroski55
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 1,479 Nov-09-2023, 10:56 AM
Last Post: mg24
  read file txt on my pc to telegram bot api Tupa 0 1,137 Jul-06-2023, 01:52 AM
Last Post: Tupa
  parse/read from file seperated by dots giovanne 5 1,128 Jun-26-2023, 12:26 PM
Last Post: DeaD_EyE
  Formatting a date time string read from a csv file DosAtPython 5 1,305 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  How do I read and write a binary file in Python? blackears 6 6,726 Jun-06-2023, 06:37 PM
Last Post: rajeshgk
  Pyserial Readline() conversion to array bprosman 1 1,922 Apr-11-2023, 12:44 AM
Last Post: deanhystad
  Read csv file with inconsistent delimiter gracenz 2 1,208 Mar-27-2023, 08:59 PM
Last Post: deanhystad
  Greek letters with .readline() and tkinter KinkgOfKeks 7 1,765 Mar-24-2023, 05:13 PM
Last Post: deanhystad
Star Pyserial not reading serial.readline fast enough while using AccelStepper on Arduino MartyTinker 4 4,115 Mar-13-2023, 04:02 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020