The 'timestamp' error indicates that wee_import is looking for date-time
data for each record in a field named timestamp, your source data has no
such field so the import fails. What is in the field map in your import
config file? I am guessing that date-time wise it is still uses the example
import config file entry:
[[FieldMap]]
dateTime = timestamp, unix_epoch
interval =
barometer = barometer, inHg
In your case (based on the sample data provided) the dateTime entry needs
to be something like (untested):
dateTime = "Date & Time", unix_epoch
In addition you will need to tell wee_import what format your date-time
data uses. You do that by setting the raw_datetime_format option in your
import config file. Again, based on your sample data, something like:
raw_datetime_format = %Y-%m-%d %H:%M
%m and %d may need to be transposed, I cannot tell from your data whether
it uses year-month-day or year-day-month.
One other thing you will need to do, if you have not already done so, is to
ensure the import config file field map contains the names of the source
data fields you wish to import. Taking the barometer line from the default
[[FieldMap]] extract I provided above you will need to change it to read:
barometer = "Barometer - hPa", hPa
Gary
On Tuesday, 1 March 2022 at 05:25:02 UTC+10 Artvd wrote:
>
> @Gary Thanks for your reaction. The offending character is likely the
> degrees sign in the title row. But after removing them I faced another
> problem: TypeError: "delimiter" must be a 1-character string
> I have tried many changes and used a one row testfile but the error
> remained. Finally i copied the data from the davis site to excell. When
> using these data there is no error. However the timestamp can not be found.
>
> This is the tile and a line of the data.csv file
>
> Date & Time;Inside Temp - C;High Inside Temp - C;Low Inside Temp -
> C;Inside Hum;High Inside Hum;Low Inside Hum;Inside Dew Point - C;Inside
> Heat Index - C;Barometer - hPa;High Bar - hPa;Low Bar - hPa;Absolute
> Pressure - hPa;Temp - C;High Temp - C;Low Temp - C;Hum;High Hum;Low Hum;Dew
> Point - C;High Dew Point - C;Low Dew Point - C;Wet Bulb - C;High Wet Bulb -
> C;Low Wet Bulb - C;Avg Wind Speed - m/s;Prevailing Wind Direction;High Wind
> Spe7ed - m/s;High Wind Direction;Wind Chill - C;Low Wind Chill - C;Heat
> Index - C;High Heat Index - C;THW Index - C;High THW Index - C;Low THW
> Index - C;Rain - mm;High Rain Rate - mm/h;Heating Degree Days;Cooling
> Degree Days
>
> *2022-01-01 00:00*
> ;21,5;21,7;21,4;53,1;53,3;52,9;11,6;20,8;1026,7;1026,7;1026,7;971,8;9,5;9,6;9,5;95,9;96,1;95,9;8,9;8,9;8,9;9,2;9,2;9,2;0;;0;;9,5;9,5;9,8;9,9;9,8;9,9;9,8;0;0;0,092;0
>
> This is the output
> sudo wee_import --import-config=/var/tmp/csv.conf --dry-run
>
> Using WeeWX configuration file /etc/weewx/weewx.conf
> Starting wee_import...
> 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.
> Starting dry run import ...
>
>
> ***** Unable to map source data.**** Field 'timestamp' not found in source
> data.**** Nothing done, exiting.*
>
> Op maandag 28 februari 2022 om 02:38:26 UTC+1 schreef gjr80:
>
>> You have two things going on here.
>>
>>
>> ***** Unable to decode source data for period 1.**** 'utf-8' codec can't
>> decode byte 0xb0 in position 29: invalid start byte*
>> **** Period 1 will be skipped. Proceeding to next period.
>> **** Consider specifying the source file encoding using the
>> 'source_encoding' config option.
>>
>> This is a warning that you have characters in your source data, in this
>> case the degree symbol, that wee_import cannot process. Consequently the
>> first period of data was skipped. The warning suggests specifying the
>> encoding using the source_encoding config option but you really need to
>> remove the offending character(s).
>>
>> The 'readonly database' error is likely due to permissions on your
>> sqlite database file and the user that was running wee_import having
>> insufficient privileges to write to that file. If WeeWX is run as the root
>> user you may need to use sudo to run wee_import, eg:
>>
>> $ sudo wee_import <rest of wee_import options>
>>
>> Gary
>> On Sunday, 27 February 2022 at 23:03:52 UTC+10 Artvd wrote:
>>
>>> I am trying to import a monthly csv file to weewx using the weewx import
>>> guideline .Unfortunately i get a error. I wonder if someone could help me
>>> to solve the problem. Below is weewx output of the dry run
>>>
>>> wee_import --import-config=/var/tmp/csv.conf --dry-run
>>> Using WeeWX configuration file /etc/weewx/weewx.conf
>>> Starting wee_import...
>>> 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.
>>> Starting dry run import ...
>>>
>>> ***** Unable to decode source data for period 1.**** 'utf-8' codec can't
>>> decode byte 0xb0 in position 29: invalid start byte*
>>> **** Period 1 will be skipped. Proceeding to next period.
>>> **** Consider specifying the source file encoding using the
>>> 'source_encoding' config option.
>>> Traceback (most recent call last):
>>> File "/usr/share/weewx/weedb/sqlite.py", line 30, in guarded_fn
>>> return fn(*args, **kwargs)
>>> File "/usr/share/weewx/weedb/sqlite.py", line 219, in execute
>>> return sqlite3.Cursor.execute(self, *args, **kwargs)
>>> sqlite3.OperationalError: attempt to write a readonly database
>>>
>>> During handling of the above exception, another exception occurred:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Traceback (most recent call last): File "/usr/share/weewx/wee_import",
>>> line 899, in <module> main() File "/usr/share/weewx/wee_import", line
>>> 829, in main source_obj.run() File
>>> "/usr/share/weewx/weeimport/weeimport.py", line 435, in run
>>> self.dbm._write_metadata('lastUpdate', str(int(new_last_update))) File
>>> "/usr/share/weewx/weewx/manager.py", line 1494, in _write_metadata
>>> _cursor.execute(DaySummaryManager.meta_replace_str % self.table_name, File
>>> "/usr/share/weewx/weedb/sqlite.py", line 44, in guarded_fn raise
>>> weedb.OperationalError(e)weedb.OperationalError: attempt to write a
>>> readonly database*
>>>
>>
--
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/3258d47f-6673-4b38-8076-d325ccd491f0n%40googlegroups.com.