I was actually able to reproduce your error by writing a very simple
program that uses PIL. The problem seems to come from passing in a byte
string that encode "µg/m³", instead of Unicode. WeeWX is not supposed to do
that, but obviously it is.

Let me work on this a bit.

I've created issue #662 <https://github.com/weewx/weewx/issues/662> to
track.

-tk

On Wed, Apr 7, 2021 at 10:50 AM richard maliszewski <[email protected]>
wrote:

> That comes back "ascii".
>
> --Richard
>
> On Wednesday, April 7, 2021 at 9:55:57 AM UTC-7 [email protected] wrote:
>
>> That all looks normal, but the default encoding could be making a
>> difference. What do you get with
>>
>> *python -c "import sys;print(sys.getdefaultencoding())"*
>>
>>
>> -tk
>>
>> On Wed, Apr 7, 2021 at 9:35 AM richard maliszewski <[email protected]>
>> wrote:
>>
>>> And BTW:
>>>
>>> *rlmalisz@minix*:*~*$ locale
>>>
>>> LANG=en_US.UTF-8
>>>
>>> LANGUAGE=
>>>
>>> LC_CTYPE="en_US.UTF-8"
>>>
>>> LC_NUMERIC="en_US.UTF-8"
>>>
>>> LC_TIME="en_US.UTF-8"
>>>
>>> LC_COLLATE="en_US.UTF-8"
>>>
>>> LC_MONETARY="en_US.UTF-8"
>>>
>>> LC_MESSAGES="en_US.UTF-8"
>>>
>>> LC_PAPER="en_US.UTF-8"
>>>
>>> LC_NAME="en_US.UTF-8"
>>>
>>> LC_ADDRESS="en_US.UTF-8"
>>>
>>> LC_TELEPHONE="en_US.UTF-8"
>>>
>>> LC_MEASUREMENT="en_US.UTF-8"
>>>
>>> LC_IDENTIFICATION="en_US.UTF-8"
>>>
>>> LC_ALL=
>>>
>>>
>>> On Wednesday, April 7, 2021 at 9:19:13 AM UTC-7 richard maliszewski
>>> wrote:
>>>
>>>> Have tried several long shots:
>>>> 1) the examples above of this working fine only had single values being
>>>> graphed, mine has two.  Commented each one out in turn, made no
>>>> difference.  Worth a poke.
>>>> 2) tried Tom's suggestion for upgrading Pillow, only to find that
>>>> nothing else to date had precipitated a need for pip on this server.  So
>>>> installed pip, and saw a surprising amount of stuff get pulled in along the
>>>> way.  Restarted WeeWX in case any of those pip-dependencies made a
>>>> difference.  Nope.
>>>> 3) upgraded Pillow, restarted WeeWX.  Same, same.
>>>>
>>>> Appreciate the help, regardless.
>>>>
>>>> --Richard
>>>>
>>>>
>>>> On Wednesday, April 7, 2021 at 5:21:20 AM UTC-7 [email protected] wrote:
>>>>
>>>>> I'm at loss, too. My Ubuntu 20.04, with Python 2.7, renders it
>>>>> perfectly.
>>>>>
>>>>> It's a long shot, but you can try upgrading Pillow. Pillow 6.2.2 was
>>>>> the last version to support Python 2.7.
>>>>>
>>>>> *sudo python2 -m pip install Pillow==6.2.2*
>>>>>
>>>>>
>>>>> -tk
>>>>>
>>>>> On Tue, Apr 6, 2021 at 10:49 AM richard maliszewski <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Python reports 2.7.17.  PIL reports 5.1.0.  Log output pretty
>>>>>> long-winded, attached.
>>>>>>
>>>>>> --Richard
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tuesday, April 6, 2021 at 7:44:33 AM UTC-7 [email protected] wrote:
>>>>>>
>>>>>>> One other thing: what version of PIL are you using? You can find out
>>>>>>> by running:
>>>>>>>
>>>>>>> *python -c "import PIL;print(PIL.__version__)"*
>>>>>>>
>>>>>>>
>>>>>>> Let's also double check the version of Python:
>>>>>>>
>>>>>>> *python -V*
>>>>>>>
>>>>>>>
>>>>>>> -tk
>>>>>>>
>>>>>>> On Mon, Apr 5, 2021 at 11:02 PM gjr80 <[email protected]> wrote:
>>>>>>>
>>>>>>>> Attached are a couple of instrumented files that should tell us
>>>>>>>> what is happening. Could you rename:
>>>>>>>>
>>>>>>>> /usr/share/weewx/weeplot/genplot.py to
>>>>>>>> /usr/share/weewx/weeplot/genplot_orig.py
>>>>>>>> /usr/share/weewx/weeplot/utilities.py to
>>>>>>>> /usr/share/weewx/weeplot/utilities_orig.py
>>>>>>>>
>>>>>>>> and then download and save the attached genplot.py and utilities.py
>>>>>>>> to directory usr/share/weewx/weeplot
>>>>>>>>
>>>>>>>> Then restart WeeWX and let it complete at least one full report
>>>>>>>> cycle. Take a copy of the log from WeeWX startup through until the 
>>>>>>>> first
>>>>>>>> report cycle finishes and post the log here.
>>>>>>>>
>>>>>>>> Gary
>>>>>>>>
>>>>>>>> On Tuesday, 6 April 2021 at 14:47:59 UTC+10 [email protected]
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Yes, /etc/weewx/skins/Seasons/font/OpenSans-Bold.ttf.  Weewx
>>>>>>>>> version is 4.40, Python is 2.7.17.  This is on Ubuntu 18.04.5 LTS.
>>>>>>>>>
>>>>>>>>> --Richard
>>>>>>>>>
>>>>>>>>> On Monday, April 5, 2021 at 8:55:46 PM UTC-7 gjr80 wrote:
>>>>>>>>>
>>>>>>>>>> So when you say that '"font/OpenSans-Bold.ttf", which does
>>>>>>>>>> exist', where exactly does it exist?
>>>>>>>>>> /etc/weewx/skins/Seasons/font/OpenSans-Bold.ttf? OpenSans-Bold.ttf 
>>>>>>>>>> is more
>>>>>>>>>> than adequate, my install is using it and rendering µg/m³ just fine. 
>>>>>>>>>> The
>>>>>>>>>> symptoms sounds very much like PIL is giving you a default font 
>>>>>>>>>> every time.
>>>>>>>>>> What version of WeeWx are you using and under which version of 
>>>>>>>>>> python is it
>>>>>>>>>> running(will be in the log on WeeWX startup)?
>>>>>>>>>>
>>>>>>>>>> Gary
>>>>>>>>>>
>>>>>>>>>> On Tuesday, 6 April 2021 at 10:00:06 UTC+10 [email protected]
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Dug through that.  The font referenced for unit_label_font_path
>>>>>>>>>>> in skin.conf for Seasons is "font/OpenSans-Bold.ttf", which does 
>>>>>>>>>>> exist.
>>>>>>>>>>> Thinking it might not have full support for the Unicode math 
>>>>>>>>>>> symbols, I
>>>>>>>>>>> changed that to "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 
>>>>>>>>>>> which
>>>>>>>>>>> supposedly covers all 256 symbols.  And I still have the weird unit
>>>>>>>>>>> label...nothing there changed.  I see no error messages WRT 
>>>>>>>>>>> rendering in
>>>>>>>>>>> the log as described in the User's Guide.
>>>>>>>>>>>
>>>>>>>>>>> What's quite odd is that the rendered text contains both the
>>>>>>>>>>> "micro" and the "cubed" symbols...it just has the extra garbage as 
>>>>>>>>>>> well.
>>>>>>>>>>>
>>>>>>>>>>> And I found where this unit value gets defined:  in
>>>>>>>>>>> /usr/share/weewx/unit.py: "microgram_per_meter_cubed": u"µg/m³".  
>>>>>>>>>>> In the
>>>>>>>>>>> HTML for the "current" line, this looks reasonable:  
>>>>>>>>>>> "&#181;g/m&#179;".
>>>>>>>>>>> But I have yet to make the image generator happy.
>>>>>>>>>>>
>>>>>>>>>>> --Richard
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Monday, April 5, 2021 at 2:39:06 PM UTC-7 gjr80 wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> Nothing to do with drivers or extensions, it’s a font issue.
>>>>>>>>>>>> Have a read of the section Funky symbols in plots
>>>>>>>>>>>> <http://weewx.com/docs/usersguide.htm#funky_symbols> in the
>>>>>>>>>>>> User’s Guide.
>>>>>>>>>>>>
>>>>>>>>>>>> Gary
>>>>>>>>>>>> On Tuesday, 6 April 2021 at 07:31:17 UTC+10 [email protected]
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> This is a minor annoyance, but I am failing to figure out
>>>>>>>>>>>>> where this is being done, or how to fix it.  Units for PM2.5 are 
>>>>>>>>>>>>> micrograms
>>>>>>>>>>>>> per meter cubed.  I've got a "current" where the units look as 
>>>>>>>>>>>>> expected:
>>>>>>>>>>>>> µg/m³.
>>>>>>>>>>>>>
>>>>>>>>>>>>> But in the generated history images, the units in the upper
>>>>>>>>>>>>> show as shown in this image: [image: Screen Shot 2021-04-05
>>>>>>>>>>>>> at 2.27.13 PM.png]
>>>>>>>>>>>>> Station data is coming from the WX1000 extension and in this
>>>>>>>>>>>>> case, some of it from the PurpleAir extension.  Looking through 
>>>>>>>>>>>>> both
>>>>>>>>>>>>> extensions, I am not seeing who/what is choosing the unit string 
>>>>>>>>>>>>> for these
>>>>>>>>>>>>> values, nor where it's getting sucked into the image generator.  
>>>>>>>>>>>>> Hints?  I
>>>>>>>>>>>>> am a week into using WeeWX, and am quite impressed, but finding 
>>>>>>>>>>>>> where the
>>>>>>>>>>>>> bodies are buried for this sort of magic.
>>>>>>>>>>>>>
>>>>>>>>>>>>> --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/d9e7b7d1-bbf1-470b-97fe-d3a6ffbfd651n%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/d9e7b7d1-bbf1-470b-97fe-d3a6ffbfd651n%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/fa487133-f08f-4f8c-bec2-84d71537d51an%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/weewx-user/fa487133-f08f-4f8c-bec2-84d71537d51an%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/7443c87b-292f-4fb6-8a03-5305ff7bc48dn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/7443c87b-292f-4fb6-8a03-5305ff7bc48dn%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/fffe253e-a7d9-4218-af39-37210a3aa287n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/fffe253e-a7d9-4218-af39-37210a3aa287n%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/CAPq0zEAzFNQvZ4bOieihq%3Dk-2V3HTu%2Bivf5e%2BWf5-XGj%2BseUYg%40mail.gmail.com.

Reply via email to