From c17686be9f1ff341823655b17392fc14d5a04681 Mon Sep 17 00:00:00 2001 From: gjr80 Date: Sat, 5 Sep 2015 12:16:15 +1000 Subject: [PATCH] More informative message if unit systems differ Previous message refers to 'archive database'. With advent of 'all in one' database model and multiple database support it would be more helpful if message said which table and database was the problem. Also changed formatting of unit_system display to zero pad to 2 characters if necessary. --- bin/weewx/manager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/weewx/manager.py b/bin/weewx/manager.py index c4e22f7d..8045b4a6 100644 --- a/bin/weewx/manager.py +++ b/bin/weewx/manager.py @@ -634,9 +634,10 @@ class Manager(object): if self.std_unit_system is not None: if unit_system != self.std_unit_system: - raise weewx.UnitError("Unit system of incoming record (0x%x) "\ - "differs from the archive database (0x%x)" % - (unit_system, self.std_unit_system)) + raise weewx.UnitError("Unit system of incoming record (0x%02x) "\ + "differs from '%s' table in '%s' database (0x%02x)" % + (unit_system, self.table_name, self.database_name, + self.std_unit_system)) else: # This is the first record. Remember the unit system to # check against subsequent records: