Python Forum
g Null Byte using DictReader
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
g Null Byte using DictReader
#11
This below error is fixed.
utf-8' codec can't decode byte 0xa0 in position 252862: invalid start byte

but currently getting error.
_csv.Error: line contains NULL byte
on line "for line in reader:"

the below error is fixed.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 252862: invalid start byte

but getting the below error now.
_csv.Error: line contains NULL byte
at line "for line in reader:"
Reply
#12
can you post minimal example that reproduce your problem as well as the input file you work with
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#13
Hi Buran,
this code is a part of my project.
and the csv file I am reading it from rest api which contains NULL Byte.
def getCSV(csv_file):
    
    stream = io.StringIO(csv_file.stream.read().decode('utf-8'),  newline=None)
    reader = csv.DictReader(stream)

    list_of_entity = []
    line_no, prev_len = 1, 0,
    for line in reader:
.......
cant share the csv as it has confidential data.

thank you for understanding.
Reply
#14
at the moment I cannot suggest anything helpful. maybe someone else could help more
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to express null value klatlap 3 816 Mar-25-2023, 10:40 AM
Last Post: klatlap
  value null when update in json file 3lnyn0 6 3,085 Dec-30-2021, 05:52 PM
Last Post: ndc85430
  'utf-8' codec can't decode byte 0xe2 in position 122031: invalid continuation byte tienttt 12 11,356 Sep-18-2020, 10:10 PM
Last Post: tienttt
  Multiple conditions, one is null moralear27 1 2,166 Sep-13-2020, 06:11 AM
Last Post: scidam
  I didnt get the NULL values salwa17 0 1,555 Jul-10-2020, 02:54 PM
Last Post: salwa17
  Find only the rows containing null values Bhavika 2 2,403 Jun-10-2020, 01:25 PM
Last Post: Bhavika
  'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte karkas 8 31,480 Feb-08-2020, 06:58 PM
Last Post: karkas
  Array/Jarray problem contains null value? Maverick0013 1 3,933 Aug-10-2018, 12:56 PM
Last Post: Windspar
  4 byte hex byte swap from binary file medievil 7 21,941 May-08-2018, 08:16 AM
Last Post: killerrex
  csv.reader vs csv.dictReader mepyyeti 3 20,719 Mar-20-2018, 08:31 AM
Last Post: buran

Forum Jump:

User Panel Messages

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