You don't have the necessary privileges to write to the SQLite database.
Try using "sudo"

sudo weectl import ...

See the wiki article *Understanding permissions
<https://github.com/weewx/weewx/wiki/Understanding-permissions>*.

-tk


On Fri, Feb 2, 2024 at 8:21 AM bhouseski <brickhouse...@gmail.com> wrote:

> so I was playing with this some more and now got the following error (see
> below).  any thoughts?
>
> Using configuration file */etc/weewx/weewx.conf*
>
> This is a dry run. Nothing will actually be done.
>
> Starting weectl 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 ...
>
> 1953 records identified for import.
>
> Unique records processed: 1953; Last timestamp: 2011-03-28 00:00:00 EDT
> (1301284800)
>
> Traceback (most recent call last):
>
>   File "/usr/share/weewx/weedb/sqlite.py", line 38, in guarded_fn
>
>     return fn(*args, **kwargs)
>
>            ^^^^^^^^^^^^^^^^^^^
>
>   File "/usr/share/weewx/weedb/sqlite.py", line 233, 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/weectl.py", line 74, in <module>
>
>     main()
>
>   File "/usr/share/weewx/weectl.py", line 66, in main
>
>     namespace.func(namespace)
>
>   File "/usr/share/weewx/weectllib/__init__.py", line 121, in dispatch
>
>     namespace.action_func(config_dict, namespace)
>
>   File "/usr/share/weewx/weectllib/import_cmd.py", line 82, in import_func
>
>     weectllib.import_actions.obs_import(config_dict,
>
>   File "/usr/share/weewx/weectllib/import_actions.py", line 58, in
> obs_import
>
>     source_obj.run()
>
>   File "/usr/share/weewx/weeimport/weeimport.py", line 439, in run
>
>     self.dbm._write_metadata('lastUpdate', str(int(new_last_update)))
>
>   File "/usr/share/weewx/weewx/manager.py", line 1667, in _write_metadata
>
>     _cursor.execute(DaySummaryManager.meta_replace_str % self.table_name,
>
>   File "/usr/share/weewx/weedb/sqlite.py", line 52, in guarded_fn
>
>     raise weedb.OperationalError(e)
>
> weedb.OperationalError: attempt to write a readonly database
>
> On Friday, January 19, 2024 at 1:31:48 p.m. UTC-5 bhouseski wrote:
>
>> yes, this worked (only tried part one).  Thank-you.
>>
>> On Thursday, January 18, 2024 at 7:54:31 p.m. UTC-5 gjr80 wrote:
>>
>>> This problem is due to small bug in our version comparison. This will be
>>> fixed in the next release. If you wish to use weectl import before the
>>> next release you have a couple of options:
>>>
>>> 1. you can download a file containing the fix for this problem and
>>> replace your v5.0.0 version of this file. To do this:
>>>
>>> - download the patched file using:
>>>
>>>   wget -P /var/tmp
>>> https://raw.githubusercontent.com/weewx/weewx/master/src/weectllib/import_actions.py
>>>
>>> - locate your installed v5.0.0 version of import_actions.py, it will be
>>> in the weectllib directory, but where that is depends on your WeeWX
>>> install type. Where to find things
>>> <http://weewx.com/docs/5.0/usersguide/where/> in the User's Guide will
>>> help. For a package install it should be in /usr/share/weewx/. For a
>>> pip install it could be in any one of a number of locations, refer to 
>>> Location
>>> of executables in a pip install
>>> <http://weewx.com/docs/5.0/usersguide/where/#location-of-executables-in-a-pip-install>
>>> for help. For a pip/git install it will be in the src directory of the
>>> directory in which you cloned the WeeWX repo.
>>>
>>> - once located replace your existing import_actions.py with the
>>> downloaded version:
>>>
>>>   cp /var/tmp/import_actions.py /usr/share/weewx/weectllib/
>>>
>>>      adjusting the destination directory to suit.
>>>
>>> - try the import again
>>>
>>> 2. you can apply the fix yourself to your installed import_actions.py.
>>> To do this:
>>>
>>> - locate your installed import_actions.py using the second step above.
>>>
>>> - once found, open import_actions.py for editing, locate the following
>>> line (circa line 26):
>>>
>>>   REQUIRED_WEEWX = "5.0.0b15"
>>>
>>>      and change it to read:
>>>
>>>   REQUIRED_WEEWX = "5.0.0"
>>>
>>> - save import_actions.py
>>>
>>> - try the import again
>>>
>>> Alternatively, you can wait and update to the next release (likely a bug
>>> fix in the not too distant future) and perform your import then.
>>>
>>> Gary
>>> On Friday 19 January 2024 at 08:40:14 UTC+10 bhouseski wrote:
>>>
>>>> Hey all, I am trying to get old weatherlink data into my Weewx 5.0
>>>> setup.  the I run the appropriate command:
>>>>
>>>> 'weectl import --import-config=/var/tmp/csv.conf --dry-run'
>>>>
>>>>  I get the following:
>>>>
>>>> 'WeeWX 5.0.0b15 or greater is required, found 5.0.0. Nothing done,
>>>> exiting.'
>>>>
>>>>
>>>> Not sure what this means.  isn't 5.0.0b15 a beta version?  I updated to
>>>> the latest version when I did a general update on my RPi 4.
>>>>
>>>>
>>>> Mike
>>>>
>>> --
> 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 weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/1a92105d-3a04-4d5a-b2e1-2e77543c97aan%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/1a92105d-3a04-4d5a-b2e1-2e77543c97aan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEA5yT7nsU99t7LPu1_1AYtxwy9iCRBaoOnqO-T1OtCLiQ%40mail.gmail.com.

Reply via email to