Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 UTF-8 decoder reports bad byte that is not there
i am getting the error:

Traceback (most recent call last): File "/home/pdh/", line 233, in <module> result=main(argv) File "/home/pdh/", line 206, in main loadinfo(f,data) File "/home/pdh/", line 123, in loadinfo for line in file: File "/usr/lib/python3.5/", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
but there is no byte 0x8b anywhere in the whole file. what should i do about this?

the file is one of the files Ubuntu's package management works with. the name of the file is /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_main_binary-amd64_Packages. i have added diagnostic output to the code and appears that the problem is happening just before EOF. the last 2 bytes of the file are 0x0a and 0x0a (an empty line at the end. the is iterating over the lines in the file with for line in file: and every line of the file has been iterated. it's like the utf-8' codec is making this up. maybe some lower level i/o code is leaving garbage in a buffer.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte karkas 8 5,942 Feb-08-2020, 06:58 PM
Last Post: karkas
  How do I generate reports in pdf format? okbeat9 2 149 Jan-13-2020, 04:38 AM
Last Post: okbeat9
  Python for Reports in HTML or PDF Format ImPyBoy17 1 790 Dec-10-2018, 09:35 PM
Last Post: j.crater
  Generate PDF reports giu88 7 3,467 Aug-26-2018, 02:00 PM
Last Post: giu88
  Start checking for geology reports tjnichols 1 797 Jun-04-2018, 08:55 PM
Last Post: Larz60+
  4 byte hex byte swap from binary file medievil 7 8,765 May-08-2018, 08:16 AM
Last Post: killerrex
  MP4 decoder jdewk 4 1,982 Jan-13-2018, 10:02 PM
Last Post: jdewk
  JSON Decoder issue Cronax3 2 6,474 Sep-13-2017, 09:23 AM
Last Post: Cronax3
  Best software for creating printed reports? birdieman 5 1,721 Feb-02-2017, 02:39 AM
Last Post: birdieman
  Reports with Python? panoss 1 1,294 Jan-11-2017, 10:33 PM
Last Post: micseydel

Forum Jump:

Users browsing this thread: 1 Guest(s)