Hi,

The clue is in the error message. Whatever process you used to create your 
csv files has resulted in the UTF-8 Byte order mark (BOM) being included at 
the start of the file and that is upsetting the python csv reader. From 
memory this issue has occurred before (or perhaps it was some other 
non-displaying sequence of bytes). In either case it is probably worthwhile 
adding some code to wee_import strip out any BOMs during the  
pre-processing of any csv files being imported. In the meantime you should 
be able to import your data by opening your csv file(s) in a text editor, 
moving to the start of the file and deleting characters one at a time until 
the first displayable character (" in data3.csv, t in data.csv) is deleted. 
Re-type the just deleted character (the file should again look just like it 
did when opened) and save the file. It should now import without problem 
(well without the BOM/null byte problem anyway).

Gary

On Monday, 23 March 2020 04:03:54 UTC+10, Janne Prokkola wrote:
>
> Hello
> I've tried to import csv without luck. I get following message.
>
> A CSV import from source file '/var/tmp/data.csv' has been requested.
> Using database binding 'wx_binding', which is bound to database 'weewx.sdb'
> Destination table 'archive' unit system is '0x01' (US).
> Missing derived observations will be calculated.
> This is a dry run, imported data will not be saved to archive.
> Traceback (most recent call last):
>   File "/usr/bin/wee_import", line 834, in <module>
>     main()
>   File "/usr/bin/wee_import", line 784, in main
>     source_obj.run()
>   File "/usr/share/weewx/weeimport/weeimport.py", line 350, in run
>     _mapped_data = self.mapRawData(_raw_data, self.archive_unit_sys)
>   File "/usr/share/weewx/weeimport/weeimport.py", line 558, in mapRawData
>     for _row in data:
>   File "/usr/lib/python2.7/csv.py", line 107, in next
>     self.fieldnames
>   File "/usr/lib/python2.7/csv.py", line 90, in fieldnames
>     self._fieldnames = self.reader.next()
> _csv.Error: line contains NULL byte
>
> Any help or ideas? The data.csv is stripped from practically everything 
> and from csv.conf I have commented nearly all fileds in FieldMap.  Attached 
> also original data3.csv.
>
>
> best regards
> Janne
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/f32459cc-4de0-4971-b0fc-7d66a4453010%40googlegroups.com.

Reply via email to