wee_database sdb --create success but --check fails

41 views
Skip to first unread message

S R

unread,
Jan 21, 2021, 3:37:10 PM1/21/21
to weewx-user

if i run wee_database -- check on the sdb that was installed during the installed, it passes.
if i rename the original sdb and then run wee_database --create, the file creates without error, but if i then immediately run the --check i get the below error

sudo wee_database --check
Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'weewx'
Checking daily summary tables version...
Daily summary tables are at version 3.0
Interval Weighting Fix is not required.
Daily summary tables version check completed in 0.01 seconds.
Preparing Null String Fix, this may take a while...
Traceback (most recent call last):
 File "/usr/share/weewx/wee_database", line 1020, in <module>
   main()
 File "/usr/share/weewx/wee_database", line 159, in main
   check(config_dict, db_binding, options)
 File "/usr/share/weewx/wee_database", line 582, in check
   check_strings(config_dict, db_binding, options, fix=False)
 File "/usr/share/weewx/wee_database", line 848, in check_strings
   % (records, timestamp_to_string(record[0])), end=' ')
UnboundLocalError: local variable 'record' referenced before assignment


John Kline

unread,
Jan 21, 2021, 3:42:10 PM1/21/21
to weewx...@googlegroups.com
I had a look.  This does not mean the database is bad.  The code needs a small fix as it’s using a variable that isn’t set if there are no records in the database.

On Jan 21, 2021, at 12:37 PM, S R <sjr4...@gmail.com> wrote:


--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/50265d72-27cc-4131-b4d7-d62bca674fe7n%40googlegroups.com.

John Kline

unread,
Jan 21, 2021, 3:53:09 PM1/21/21
to weewx...@googlegroups.com
Tom, the lines starting at line number 846 in wee_database need to be skipped if records == 0.  Not sure how you want to do that and whether you want a summary that says “no records in database”.  It will be easier for you to fix than to go back and forth with a PR.

On Jan 21, 2021, at 12:42 PM, John Kline <jo...@johnkline.com> wrote:



Tom Keffer

unread,
Jan 21, 2021, 5:15:52 PM1/21/21
to weewx-user
Not exactly a big problem, but fixed in commit 0f67337.


S R

unread,
Jan 21, 2021, 5:58:15 PM1/21/21
to weewx-user
i also get
./bin/wee_database --update
Using configuration file /usr/local/share/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_sqlite'
The update process does not affect archive data, but does alter the database.
Continue (y/n)? y
Preparing Interval Weighting Fix...

Daily summary tables are at version 3.0
Interval weighting fix is not required.
Preparing Maximum windSpeed Fix...

Traceback (most recent call last):
  File "./bin/wee_database", line 1020, in <module>
    main()
  File "./bin/wee_database", line 162, in main
    update(config_dict, db_binding, options)
  File "./bin/wee_database", line 639, in update
    _fix_wind(config_dict, db_binding, options)
  File "./bin/wee_database", line 742, in _fix_wind
    wind_obj.run()
  File "/usr/local/share/weewx/bin/weecfg/database.py"
Reply all
Reply to author
Forward
0 new messages