Rats. Try this version.

On Thu, Jan 23, 2020 at 5:07 PM Thomas Keffer <tkef...@gmail.com> wrote:

> Try replacing your version of weewx/defaults.py with the attached and
> see if that helps.
>
> Bit of a hack. I'll keep searching for something more elegant.
>
> On Thu, Jan 23, 2020 at 3:54 PM Thomas Keffer <tkef...@gmail.com> wrote:
>
>> Just as I suspected. The patch that fixed things for configobj v4.7.2,
>> broke v5.0.6.
>>
>> Can't help but feel that I'm approaching this all wrong. Got to give it a
>> deep think.
>>
>> -tk
>>
>> On Thu, Jan 23, 2020 at 3:38 PM gjr80 <gjroder...@gmail.com> wrote:
>>
>>> 5.0.6
>>>
>>> gary@stretch40:~/src/weewx$ python2 -c "import configobj;
>>> print(configobj.__version__)"
>>> 5.0.6
>>>
>>> Gary
>>>
>>> On Friday, 24 January 2020 09:37:04 UTC+10, Thomas Keffer wrote:
>>>>
>>>> OK, now we know what went wrong, but we don't know why.
>>>>
>>>> What version of ConfigObj are you using?
>>>>
>>>> *python2 -c "import configobj; print(configobj.__version__)"*
>>>>
>>>> -tk
>>>>
>>>>
>>>>
>>>> On Thu, Jan 23, 2020 at 3:22 PM gjr80 <gjrod...@gmail.com> wrote:
>>>>
>>>>> That got it!
>>>>>
>>>>> Gary
>>>>>
>>>>> Jan 24 09:10:51 stretch40 weewx[777] INFO weewx.engine: Starting main
>>>>> packet loop.
>>>>> Jan 24 09:15:16 stretch40 weewx[777] INFO weewx.manager: Added record
>>>>> 2020-01-24 09:15:00 AEST (1579821300) to database 'weewx.sdb'
>>>>> Jan 24 09:15:16 stretch40 weewx[777] INFO weewx.manager: Added record
>>>>> 2020-01-24 09:15:00 AEST (1579821300) to daily summary in 'weewx.sdb'
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: 'ascii' codec
>>>>> can't decode byte 0xc2 in position 0: ordinal not in range(128)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: val_str=0.3
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units:
>>>>> type(val_str)=<type 'unicode'>
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: s=°C
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: type(s)=<type '
>>>>> str'>
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> Generate failed with exception '<type 'exceptions.UnicodeDecodeError'>
>>>>> '
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> **** Ignoring template /home/weewx/skins/Seasons/index.html.tmpl
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> **** Reason: 'ascii' codec can't decode byte 0xc2 in position 0:
>>>>> ordinal not in range(128)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****  Traceback (most recent call last):
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 329, in
>>>>> generate
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      unicode_string = compiled_template.respond()
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "_home_weewx_skins_Seasons_index_html_tmpl.py", line 214,
>>>>> in respond
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py",
>>>>> line 1615, in _handleCheetahInclude
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "_home_weewx_skins_Seasons_current_inc.py", line 355, in
>>>>> respond
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 642, in
>>>>> filter
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      filtered = six.text_type(val)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/units.py", line 1054, in __str__
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      return self.toString()
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/units.py", line 1049, in toString
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      localize=localize)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/units.py", line 775, in toString
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      val_str += s
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in
>>>>> position 0: ordinal not in range(128)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: 'ascii' codec
>>>>> can't decode byte 0xc2 in position 0: ordinal not in range(128)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: val_str=0.3
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: type(val_str
>>>>> )=<type 'unicode'>
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: s=°C
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.units: type(s)=<type
>>>>> 'str'>
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> Generate failed with exception '<type 'exceptions.UnicodeDecodeError
>>>>> '>'
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> **** Ignoring template /home/weewx/skins/Seasons/rss.xml.tmpl
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> **** Reason: 'ascii' codec can't decode byte 0xc2 in position 0:
>>>>> ordinal not in range(128)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****  Traceback (most recent call last):
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 329, in
>>>>> generate
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      unicode_string = compiled_template.respond()
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "_home_weewx_skins_Seasons_rss_xml_tmpl.py", line 131, in
>>>>> respond
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 642, in
>>>>> filter
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      filtered = six.text_type(val)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/units.py", line 1054, in __str__
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      return self.toString()
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/units.py", line 1049, in toString
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      localize=localize)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****    File "/home/weewx/bin/weewx/units.py", line 775, in toString
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****      val_str += s
>>>>> Jan 24 09:15:17 stretch40 weewx[777] ERROR weewx.cheetahgenerator:
>>>>> ****  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in
>>>>> position 0: ordinal not in range(128)
>>>>> Jan 24 09:15:17 stretch40 weewx[777] INFO weewx.cheetahgenerator:
>>>>> Generated 6 files for report SeasonsReport in 0.42 seconds
>>>>> Jan 24 09:15:17 stretch40 weewx[777] INFO weewx.imagegenerator:
>>>>> Generated 14 images for SeasonsReport in 0.13 seconds
>>>>> Jan 24 09:15:17 stretch40 weewx[777] INFO weewx.reportengine: Copied 5
>>>>> files to /home/weewx/public_html
>>>>>
>>>>>
>>>>>
>>>>> On Thursday, 23 January 2020 23:35:54 UTC+10, Thomas Keffer wrote:
>>>>>>
>>>>>> Grumble!
>>>>>>
>>>>>> Try this one.
>>>>>>
>>>>>> --
>>>>> 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...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/weewx-user/7bf9adfb-73be-48ad-b188-fa3caf87b86c%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/weewx-user/7bf9adfb-73be-48ad-b188-fa3caf87b86c%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/6a38344c-aa3e-4d86-9425-e3fb1dda875b%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/6a38344c-aa3e-4d86-9425-e3fb1dda875b%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/CAPq0zECpbY-7WPJSLAUkzEber%3D-JsVxCT8QOO2fQ2noOsGimXA%40mail.gmail.com.
# coding: utf-8
#
#    Copyright (c) 2019-2020 Tom Keffer <tkef...@gmail.com>
#
#    See the file LICENSE.txt for your rights.
#

"""Backstop defaults used in the absence of any other values."""

from __future__ import absolute_import
from six.moves import StringIO
import configobj

DEFAULT_STR = """# Copyright (c) 2009-2020 Tom Keffer <tkef...@gmail.com>
# See the file LICENSE.txt for your rights.

# Where the skins reside, relative to WEEWX_ROOT
SKIN_ROOT = skins

# Where the generated reports should go, relative to WEEWX_ROOT
HTML_ROOT = public_html

# The database binding indicates which data should be used in reports.
data_binding = wx_binding

# Whether to log a successful operation
log_success = True

# Whether to log an unsuccessful operation
log_failure = False

# The following section determines the selection and formatting of units.
[Units]

    # The following section sets what unit to use for each unit group.
    # NB: The unit is always in the singular. I.e., 'mile_per_hour',
    # NOT 'miles_per_hour'
    [[Groups]]

        group_altitude     = foot                 # Options are 'foot' or 'meter'
        group_amp          = amp
        group_concentration= microgram_per_meter_cubed
        group_data         = byte
        group_degree_day   = degree_F_day         # Options are 'degree_F_day' or 'degree_C_day'
        group_deltatime    = second
        group_direction    = degree_compass
        group_distance     = mile                 # Options are 'mile' or 'km'
        group_energy       = watt_hour
        group_energy2      = watt_second
        group_length       = inch
        group_moisture     = centibar
        group_percent      = percent
        group_pressure     = inHg                 # Options are 'inHg', 'mmHg', 'mbar', or 'hPa'
        group_radiation    = watt_per_meter_squared
        group_rain         = inch                 # Options are 'inch', 'cm', or 'mm'
        group_rainrate     = inch_per_hour        # Options are 'inch_per_hour', 'cm_per_hour', or 'mm_per_hour'
        group_speed        = mile_per_hour        # Options are 'mile_per_hour', 'km_per_hour', 'knot', or 'meter_per_second'
        group_speed2       = mile_per_hour2       # Options are 'mile_per_hour2', 'km_per_hour2', 'knot2', or 'meter_per_second2'
        group_temperature  = degree_F             # Options are 'degree_F' or 'degree_C'
        group_uv           = uv_index
        group_volt         = volt
        group_volume       = gallon

        # The following are used internally and should not be changed:
        group_count        = count
        group_interval     = minute
        group_time         = unix_epoch
        group_elapsed      = second

    # The following section sets the formatting for each type of unit.
    [[StringFormats]]

        centibar           = %.0f
        cm                 = %.2f
        cm_per_hour        = %.2f
        degree_C           = %.1f
        degree_F           = %.1f
        degree_compass     = %.0f
        foot               = %.0f
        hPa                = %.1f
        hour               = %.1f
        inHg               = %.3f
        inch               = %.2f
        inch_per_hour      = %.2f
        km                 = %.1f
        km_per_hour        = %.0f
        km_per_hour2       = %.1f
        knot               = %.0f
        knot2              = %.1f
        mbar               = %.1f
        meter              = %.0f
        meter_per_second   = %.1f
        meter_per_second2  = %.1f
        mile               = %.1f
        mile_per_hour      = %.0f
        mile_per_hour2     = %.1f
        mm                 = %.1f
        mmHg               = %.1f
        mm_per_hour        = %.1f
        percent            = %.0f
        second             = %.0f
        uv_index           = %.1f
        volt               = %.1f
        watt_per_meter_squared = %.0f
        NONE               = "   N/A"

    # The following section sets the label to be used for each type of unit
    [[Labels]]

        centibar          = " cb"
        cm                = " cm"
        cm_per_hour       = " cm/h"
        degree_C          =   °C
        degree_F          =   °F
        degree_compass    =   °
        foot              = " feet"
        hPa               = " hPa"
        inHg              = " inHg"
        inch              = " in"
        inch_per_hour     = " in/h"
        km                = " km"
        km_per_hour       = " km/h"
        km_per_hour2      = " km/h"
        knot              = " knots"
        knot2             = " knots"
        mbar              = " mbar"
        meter             = " meter", " meters"
        meter_per_second  = " m/s"
        meter_per_second2 = " m/s"
        mile              = " mile", " miles"
        mile_per_hour     = " mph"
        mile_per_hour2    = " mph"
        mm                = " mm"
        mmHg              = " mmHg"
        mm_per_hour       = " mm/h"
        percent           =   %
        volt              = " V"
        watt_per_meter_squared = " W/m²"
        day               = " day",    " days"
        hour              = " hour",   " hours"
        minute            = " minute", " minutes"
        second            = " second", " seconds"
        NONE              = ""

    # The following section sets the format to be used for each time scale.
    # The values below will work in every locale, but they may not look
    # particularly attractive. See the Customization Guide for alternatives.
    [[TimeFormats]]

        hour       = %H:%M
        day        = %X
        week       = %X (%A)
        month      = %x %X
        year       = %x %X
        rainyear   = %x %X
        current    = %x %X
        ephem_day  = %X
        ephem_year = %x %X

    [[Ordinates]]

        # Ordinal directions. The last one should be for no wind direction
        directions = N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW, N/A

    # The following section sets the base temperatures used for the
    #  calculation of heating and cooling degree-days.
    [[[DegreeDays]]]

        # Base temperature for heating days, with unit:
        heating_base = 65, degree_F
        # Base temperature for cooling days, with unit:
        cooling_base = 65, degree_F
        # Base temperature for growing days, with unit:
        growing_base = 50, degree_F

    # A trend takes a difference across a time period. The following
    # section sets the time period, and how big an error is allowed to
    # still be counted as the start or end of a period.
    [[[Trend]]]

        time_delta = 10800  # 3 hours
        time_grace = 300    # 5 minutes

# The labels are applied to observations or any other strings.
[Labels]

    # Set to hemisphere abbreviations suitable for your location:
    hemispheres = N, S, E, W
    # Formats to be used for latitude whole degrees, longitude whole
    # degrees, and minutes:
    latlon_formats = "%02d", "%03d", "%05.2f"

    # Generic labels, keyed by an observation type.
    [[Generic]]
        barometer      = Barometer
        barometerRate  = Barometer Change Rate
        dewpoint       = Dew Point
        ET             = ET
        heatindex      = Heat Index
        inHumidity     = Inside Humidity
        inTemp         = Inside Temperature
        outHumidity    = Humidity
        outTemp        = Outside Temperature
        radiation      = Radiation
        rain           = Rain
        rainRate       = Rain Rate
        UV             = UV Index
        windDir        = Wind Direction
        windGust       = Gust Speed
        windGustDir    = Gust Direction
        windSpeed      = Wind Speed
        windchill      = Wind Chill
        windgustvec    = Gust Vector
        windvec        = Wind Vector
        windrun        = Wind Run
        extraTemp1     = Temperature1
        extraTemp2     = Temperature2
        extraTemp3     = Temperature3

        # Sensor status indicators

        rxCheckPercent       = Signal Quality
        txBatteryStatus      = Transmitter Battery
        windBatteryStatus    = Wind Battery
        rainBatteryStatus    = Rain Battery
        outTempBatteryStatus = Outside Temperature Battery
        inTempBatteryStatus  = Inside Temperature Battery
        consBatteryVoltage   = Console Battery
        heatingVoltage       = Heating Battery
        supplyVoltage        = Supply Voltage
        referenceVoltage     = Reference Voltage

[Almanac]

    # The labels to be used for the phases of the moon:
    moon_phases = New, Waxing crescent, First quarter, Waxing gibbous, Full, Waning gibbous, Last quarter, Waning crescent
"""

# This is a bit of a hack. ConfigObj V5 requires Unicode; earlier versions require byte-strings.
if configobj.__version__ >= '5.0.0':
    import six
    DEFAULT_STR = six.ensure_text(DEFAULT_STR)
defaults = configobj.ConfigObj(StringIO(DEFAULT_STR), encoding='utf-8', default_encoding='utf-8')

Reply via email to