Fixed in commit e51b2a6 <https://github.com/weewx/weewx/commit/e51b2a63a593a31f483054f66aea04580415d4bb> .
On Thu, Apr 8, 2021 at 5:31 AM Tom Keffer <[email protected]> wrote: > One more thing to add: it's OK to define the label using UTF-8, but the > purple air author should have indicated that s/he was using a byte string. > > weewx.units.default_unit_label_dict['microgram_per_meter_cubed'] = b' > \xc2\xb5g/m\xc2\xb3' > > On Thu, Apr 8, 2021 at 5:04 AM Tom Keffer <[email protected]> wrote: > >> So, it seems the problem is 3rd parties defining labels as byte strings, >> rather than as unicode strings. We can guard against that by converting to >> unicode in the plotting modules. >> >> Thanks, Richard. >> >> On Wed, Apr 7, 2021 at 6:42 PM richard maliszewski < >> [email protected]> wrote: >> >>> It looks like it gets defined identically in >>> /usr/share/weewx/gw1000.py. But also gets defined in >>> /usr/share/weewx/user/purpleair.py line 77 via: >>> weewx.units.default_unit_label_dict['microgram_per_meter_cubed'] = ' >>> \xc2\xb5g/m\xc2\xb3' >>> Python are not close friends, but that smelled like a string rather than >>> Unicode, so I commented it out. Log now says: >>> >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to '%', which is type '<type 'unicode'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to '%', which is type '<type 'unicode'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to 'in', which is type '<type 'unicode'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to 'mph', which is type '<type 'unicode'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to 'mph', which is type '<type 'unicode'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to 'µg/m³', which is type '<type 'unicode'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to 'µg/m³', which is type '<type 'unicode'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to '', which is type '<type 'str'>' >>> Apr 7 18:40:26 minix weewx[30594] INFO weeplot.genplot: Unit label set >>> to '', which is type '<type 'unicode'>' >>> >>> And graph label looks fine. I'll let the Purple Air extension author >>> know to have a look at this. Thanks for the help! >>> >>> --Richard >>> On Wednesday, April 7, 2021 at 6:13:46 PM UTC-7 [email protected] wrote: >>> >>>> Alright! Now we're getting somewhere! For some reason 'µg/m³' is >>>> showing up as a string, despite it being marked as unicode in units.py. >>>> >>>> And, you are sure that the only place µg/m³ is used is in units.py? You >>>> can search by using the following: >>>> >>>> *find /usr/share/weewx /etc/weewx -type f|xargs grep 'µg/m³'* >>>> >>>> >>>> >>>> >>>> On Wed, Apr 7, 2021 at 4:52 PM richard maliszewski <[email protected]> >>>> wrote: >>>> >>>>> I suspect as you suspected: >>>>> >>>>> Apr 7 16:45:21 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to '%', which is type '<type 'unicode'>' >>>>> >>>>> Apr 7 16:45:21 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to '%', which is type '<type 'unicode'>' >>>>> >>>>> Apr 7 16:45:22 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to 'in', which is type '<type 'unicode'>' >>>>> >>>>> Apr 7 16:45:22 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to 'mph', which is type '<type 'unicode'>' >>>>> >>>>> Apr 7 16:45:22 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to 'mph', which is type '<type 'unicode'>' >>>>> >>>>> Apr 7 16:45:22 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to 'µg/m³', which is type '<type 'str'>' >>>>> >>>>> Apr 7 16:45:22 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to 'µg/m³', which is type '<type 'str'>' >>>>> >>>>> Apr 7 16:45:22 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to '', which is type '<type 'str'>' >>>>> >>>>> Apr 7 16:45:22 minix weewx[29999] INFO weeplot.genplot: Unit label >>>>> set to '', which is type '<type 'unicode'>' >>>>> >>>>> --Richard >>>>> >>>>> -- >>>>> 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 [email protected]. >>>>> >>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/weewx-user/67cc02d7-5159-4f0a-8848-e614ffaa4d64n%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/weewx-user/67cc02d7-5159-4f0a-8848-e614ffaa4d64n%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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/weewx-user/4753a452-710a-48a5-86e6-0500e95484a1n%40googlegroups.com >>> <https://groups.google.com/d/msgid/weewx-user/4753a452-710a-48a5-86e6-0500e95484a1n%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEBUnwDEU3OGFPEss74PXpF84i2JWh%3D-F3qn3YmJUa%2B4mw%40mail.gmail.com.
