To add, the ImageFont PIL library needs importing:
from PIL import Image, ImageColor, ImageDraw, *ImageFont*
On Saturday, 25 October 2025 at 19:32:03 UTC+1 Auchtermuchty Weather wrote:
> I've actually managed to fix my code. I'm amazed! I made a function that
> returns width & height from the text & font:
>
> def get_hw( text, font ):
> left, top, right, bottom = font.getbbox( text )
> width = right - left
> height = bottom - top
>
> return width, height
>
> So, e.g.,
> self.title_width, self.title_height =
> self.draw.textsize(self.title, font=self.label_font)
>
> becomes
> self.title_width, self.title_height = self.get_hw( self.title,
> self.label_font )
>
> Will be sorting out my own GitHub maybe tomorrow and testing it on a fresh
> Debian 13 installation.
>
> The following were the resources that helped me do that:
>
> https://github.com/python-pillow/Pillow/issues/6938
> https://pillow.readthedocs.io/en/stable/deprecations.html
>
>
> On Saturday, 25 October 2025 at 17:15:46 UTC+1 vince wrote:
>
>> update - wget
>> https://github.com/vinceskahan/upstream-repos/raw/refs/heads/main/weewx-stackedwindrose.tgz
>>
>>
>> I reorganized a few months ago so locations have changed. All my stashed
>> upstream stuff is in https://github.com/vinceskahan/upstream-repos/ - be
>> sure to read the README file for how to download pieces rather than the
>> whole directory of many upstream pieces of software
>>
>> On Saturday, October 25, 2025 at 4:38:14 AM UTC-7 Auchtermuchty Weather
>> wrote:
>>
>>> Your URL is now a 404 page :(
>>>
>>> I am having the same sort of problems, if you could let me have your
>>> version with the problem fixed I'd be very grateul.
>>>
>>> On Sunday, 10 August 2025 at 20:27:53 UTC+1 vince wrote:
>>>
>>>> You have an old version of stackedwindrose.py - you need this version
>>>> which works with pillow 10.x
>>>>
>>>> 6 July 2023 v3.0.2
>>>> - fix error due to deprecated PIL.ImageDraw.textsize() method
>>>> being
>>>> removed from PIL 10.0
>>>>
>>>> I have a .tgz of that version and can put up a github repo later today
>>>> if I get a chance. Have some patience :-)
>>>>
>>>> On Sunday, August 10, 2025 at 12:22:58 PM UTC-7 Tom Keffer wrote:
>>>>
>>>>> Your analysis is correct. You have two choices:
>>>>>
>>>>> 1. Downgrade to Pillow V9.5, which still uses textsize.
>>>>> 2. Make the necessary changes to stackedwindrose.py yourself. This
>>>>> involves mostly substituting "textlength" everywhere you see "textsize",
>>>>> except that the latter returns a 2-way tuple of (width, length), while
>>>>> the
>>>>> former is just a simple scalar of width.
>>>>>
>>>>> -tk
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Aug 10, 2025 at 11:52 AM 'Christian Peters' via weewx-user <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I noticed that sadly gjr80 and all his great stuff on GIT for weewx
>>>>>> seems to be gone!?
>>>>>>
>>>>>> Now my Stacked Windrose Image Generator extension stops working on
>>>>>> Debian13 AND WEEX 5.1.0 with this error:
>>>>>>
>>>>>> Caught unrecoverable exception in generator
>>>>>> 'user.stackedwindrose.StackedWindRoseImageGenerator'
>>>>>> 2025-08-10T20:42:38.140846+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** type object 'ImageDraw' has no
>>>>>> attribute
>>>>>> 'textsize'
>>>>>> 2025-08-10T20:42:38.143494+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** Traceback (most recent call last):
>>>>>> 2025-08-10T20:42:38.143695+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** File
>>>>>> "/usr/share/weewx/weewx/reportengine.py", line 248, in run
>>>>>> 2025-08-10T20:42:38.143873+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** obj.start()
>>>>>> 2025-08-10T20:42:38.144061+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** ~~~~~~~~~^^
>>>>>> 2025-08-10T20:42:38.144194+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** File
>>>>>> "/usr/share/weewx/weewx/reportengine.py", line 465, in start
>>>>>> 2025-08-10T20:42:38.144371+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** self.run()
>>>>>> 2025-08-10T20:42:38.144510+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** ~~~~~~~~^^
>>>>>> 2025-08-10T20:42:38.144607+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** File
>>>>>> "/etc/weewx/bin/user/stackedwindrose.py", line 228, in run
>>>>>> 2025-08-10T20:42:38.144717+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** self.gen_images(self.gen_ts)
>>>>>> 2025-08-10T20:42:38.144835+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.144944+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** File
>>>>>> "/etc/weewx/bin/user/stackedwindrose.py", line 447, in gen_images
>>>>>> 2025-08-10T20:42:38.145061+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** text_w, text_h =
>>>>>> self.draw.textsize("0 (100%)",
>>>>>> 2025-08-10T20:42:38.145204+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: ****
>>>>>> ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.145367+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: ****
>>>>>> font=self.legend_font)
>>>>>> 2025-08-10T20:42:38.145489+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: ****
>>>>>> ^^^^^^^^^^^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.145747+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** File
>>>>>> "/etc/weewx/bin/user/stackedwindrose.py", line 822, in textsize
>>>>>> 2025-08-10T20:42:38.145951+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** return
>>>>>> ImageDraw.ImageDraw.textsize(self, string, **options)
>>>>>> 2025-08-10T20:42:38.146199+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.146510+02:00 weewx weewxd[3909]: Traceback (most
>>>>>> recent call last):
>>>>>> 2025-08-10T20:42:38.148982+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** AttributeError: type object
>>>>>> 'ImageDraw'
>>>>>> has no attribute 'textsize'
>>>>>> 2025-08-10T20:42:38.149142+02:00 weewx weewxd[3909]: File
>>>>>> "/usr/share/weewx/weewx/reportengine.py", line 248, in run
>>>>>> 2025-08-10T20:42:38.151192+02:00 weewx weewxd[3909]: obj.start()
>>>>>> 2025-08-10T20:42:38.152532+02:00 weewx weewxd[3909]: ~~~~~~~~~^^
>>>>>> 2025-08-10T20:42:38.153693+02:00 weewx weewxd[3909]: File
>>>>>> "/usr/share/weewx/weewx/reportengine.py", line 465, in start
>>>>>> 2025-08-10T20:42:38.154853+02:00 weewx weewxd[3909]: self.run()
>>>>>> 2025-08-10T20:42:38.156503+02:00 weewx weewxd[3909]: ~~~~~~~~^^
>>>>>> 2025-08-10T20:42:38.157701+02:00 weewx weewxd[3909]: File
>>>>>> "/etc/weewx/bin/user/stackedwindrose.py", line 228, in run
>>>>>> 2025-08-10T20:42:38.158983+02:00 weewx weewxd[3909]:
>>>>>> self.gen_images(self.gen_ts)
>>>>>> 2025-08-10T20:42:38.160126+02:00 weewx weewxd[3909]:
>>>>>> ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.161340+02:00 weewx weewxd[3909]: File
>>>>>> "/etc/weewx/bin/user/stackedwindrose.py", line 447, in gen_images
>>>>>> 2025-08-10T20:42:38.162448+02:00 weewx weewxd[3909]: text_w,
>>>>>> text_h = self.draw.textsize("0 (100%)",
>>>>>> 2025-08-10T20:42:38.163580+02:00 weewx weewxd[3909]:
>>>>>> ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.164748+02:00 weewx weewxd[3909]:
>>>>>> font=self.legend_font)
>>>>>> 2025-08-10T20:42:38.165938+02:00 weewx weewxd[3909]:
>>>>>> ^^^^^^^^^^^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.167060+02:00 weewx weewxd[3909]: File
>>>>>> "/etc/weewx/bin/user/stackedwindrose.py", line 822, in textsize
>>>>>> 2025-08-10T20:42:38.168423+02:00 weewx weewxd[3909]: return
>>>>>> ImageDraw.ImageDraw.textsize(self, string, **options)
>>>>>> 2025-08-10T20:42:38.169717+02:00 weewx weewxd[3909]:
>>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>>> 2025-08-10T20:42:38.170863+02:00 weewx weewxd[3909]: AttributeError:
>>>>>> type object 'ImageDraw' has no attribute 'textsize'
>>>>>> 2025-08-10T20:42:38.172150+02:00 weewx weewxd[3909]: ERROR
>>>>>> weewx.reportengine: **** Generator terminated
>>>>>>
>>>>>> Seems to be because some changes made Pillow 10.
>>>>>> My version of stackewindrose extension is Version: 3.0., Date: 7 June
>>>>>> 2020
>>>>>>
>>>>>> Has someone forked it or patched this to get it back working with
>>>>>> Pillow 10.
>>>>>> Sadly I don't have any skills regarding python. Or can I downgrade to
>>>>>> Vers 9.x....!?
>>>>>>
>>>>>>
>>>>>> Thansk in advance!
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Christain
>>>>>>
>>>>>> --
>>>>>> 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 visit
>>>>>> https://groups.google.com/d/msgid/weewx-user/9ce297c8-4b76-497c-9faf-8d0d1d4ab2ffn%40googlegroups.com
>>>>>>
>>>>>> <https://groups.google.com/d/msgid/weewx-user/9ce297c8-4b76-497c-9faf-8d0d1d4ab2ffn%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 visit
https://groups.google.com/d/msgid/weewx-user/a2a89b1a-ac3e-4c31-88d1-65d247ac0c68n%40googlegroups.com.