python error after reinstalling with 4.1.1 python3

92 views
Skip to first unread message

Andrew H

unread,
Sep 21, 2020, 10:08:27 PM9/21/20
to weewx-user
Hi all,

Aweosmse software, have been using it since about 2015 without issue!

I'm running a Davis Vantage Vue w/usb connected to a raspberry pi.

I have just done a clean install of raspbian and have attempted an install with 4.1.1 from apt repo using python3 but I'm hitting an error when it tries to add entries to the archive. I export to mysql and from looking into the error it appears to be a python3 thing...

Error:

Config:



cheers
Andrew



Andrew H

unread,
Sep 21, 2020, 11:05:19 PM9/21/20
to weewx-user
Had a look around some existing posts regarding similar issues and with some guidance from friends smarter than me, ended up changing this line (1160):

weight = 60.0 * record['interval'] if self.version >= '2.0' else 1.0

to

weight = 60.0 * record['interval'] if self.version is not None and self.version >= '2.0' else 1.0

and it's working ok now...

gjr80

unread,
Sep 21, 2020, 11:34:12 PM9/21/20
to weewx-user
Hi,

I'm sure the guidance you received was well intentioned but it is nothing more than papering over the cracks and the issue will come back to bite in the future. In particular, the next time you upgrade WeeWX you will be back in the same predicament, better to fix the issue properly. I suggest you try the following:

1. stop WeeWX
2. revert the change you made to manager.py
3. run wee_database with the --update action:

$ wee_database --update

4. restart WeeWX

That should fix the problem, if not post the error trace from the log.

Gary

Andrew H

unread,
Sep 22, 2020, 1:01:01 AM9/22/20
to weewx-user
Thanks Gary,

I did as suggested, and received the following:

Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_mysql'
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 None
Calculating interval weights...
Traceback (most recent call last):
  File "/usr/share/weewx/wee_database", line 974, in <module>
    main()
  File "/usr/share/weewx/wee_database", line 154, in main
    update(config_dict, db_binding, options)
  File "/usr/share/weewx/wee_database", line 584, in update
    weight_obj.run()
  File "/usr/share/weewx/weecfg/database.py", line 426, in run
    self.do_fix(_next_day_to_patch_ts)
  File "/usr/share/weewx/weecfg/database.py", line 483, in do_fix
    _weight = self.get_interval(_day_span) * 60
  File "/usr/share/weewx/weecfg/database.py", line 580, in get_interval
    return _row[0]
TypeError: 'NoneType' object is not subscriptable


gjr80

unread,
Sep 22, 2020, 1:37:56 AM9/22/20
to weewx-user
Hmm, something is not right in your database. This will seem a roundabout way to do things but could you try dropping and rebuilding the daily summaries before running --update. The sequence of commands will be:

1. stop WeeWX

2. drop the daily summaries:
$ wee_database --drop-daily

3. rebuild the daily summaries:
$ wee_database --rebuild-daily

4. apply the database updates:
$ wee_database --update

Gary

Andrew H

unread,
Sep 22, 2020, 2:46:42 AM9/22/20
to weewx...@googlegroups.com
Thanks again, that did the trick! Much obliged.

root@fhls-weewx01:/var/www/html# wee_database --drop-daily

Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_mysql'
Proceeding will delete all your daily summaries from database 'weewxfhls'
Are you sure you want to proceed (y/n)? y
Dropping daily summary tables from 'weewxfhls' ...
Daily summary tables dropped from database 'weewxfhls' in 1.76 seconds
root@fhls-weewx01:/var/www/html# wee_database --rebuild-daily

Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_mysql'
All daily summaries will be rebuilt.
Proceed (y/n)? y
Rebuilding daily summaries in database 'weewxfhls' ...
Records processed: 121000; Last date: 2020-09-19 10:40:00 AEST (1600476000)
Processed 121902 records to rebuild 425 daily summaries in 2404.20 seconds        
Rebuild of daily summaries in database 'weewxfhls' complete                      
root@fhls-weewx01:/var/www/html# wee_database --update                            

Using configuration file /etc/weewx/weewx.conf                                    
Using database binding 'wx_binding', which is bound to database 'archive_mysql'  
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 2.0                                          
Interval Weighting Fix is not required.                                          
Preparing Maximum windSpeed Fix...                                                
Updating 'windSpeed' daily summary: 425; Timestamp: 2020-09-22 (1600696800)      
Maximum windSpeed Fix completed in 7.97 seconds                                   

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/hRbR5p4A9BM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/26f6df8f-c8f0-43a3-893d-b2d5e0ac0564n%40googlegroups.com.

gjr80

unread,
Sep 22, 2020, 3:30:48 AM9/22/20
to weewx-user
Good news. Looking back the drop and rebuild may have done the trick by themselves to start with, didn’t think that fixed the daily summary version problem though. Good rule of thumb with the database, if you can fix it via the utilities, particularly wee_database, you will often save yourself a headache later on.

Gary

Tom Keffer

unread,
Sep 22, 2020, 7:00:14 AM9/22/20
to weewx-user
Thanks for not only finding this, but coming up with a fix, Andrew. I'm surprised this bug survived for so long.

I took a slightly different approach. Commit 12c635a.

-tk

--
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/9e661f0d-16bc-4480-92fc-f87b43072fc6n%40googlegroups.com.

Tom Keffer

unread,
Sep 22, 2020, 7:25:45 AM9/22/20
to weewx-user
Sorry, Gary. I just saw your response. I suspect the root problem is that very old databases do not have a version number, and we failed to check for that. Hence, the commit.
Reply all
Reply to author
Forward
0 new messages