Bottom Page

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:"
Quote
#12
can you post minimal example that reproduce your problem as well as the input file you work with
Quote
#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.
Quote
#14
at the moment I cannot suggest anything helpful. maybe someone else could help more
Quote

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 7 281 Sep-12-2019, 11:19 PM
Last Post: newbieAuggie2019
  Handling null or empty entries from Entry Widget KevinBrown 1 251 Mar-17-2019, 04:22 PM
Last Post: perfringo
  Array/Jarray problem contains null value? Maverick0013 1 796 Aug-10-2018, 12:56 PM
Last Post: Windspar
  Replace null values in Json file burnsssss 11 7,516 Jun-11-2018, 09:45 AM
Last Post: burnsssss
  4 byte hex byte swap from binary file medievil 7 6,128 May-08-2018, 08:16 AM
Last Post: killerrex
  csv.reader vs csv.dictReader mepyyeti 3 6,011 Mar-20-2018, 08:31 AM
Last Post: buran
  xmlrpc.client, ServerProxy and null return thepurpleblob 0 1,057 Oct-26-2017, 10:26 AM
Last Post: thepurpleblob

Forum Jump:


Users browsing this thread: 1 Guest(s)