Mystery solved: https://github.com/python-pillow/Pillow/pull/6978

I'm sure they broke a lot of code with this change.

On Mon, Apr 3, 2023 at 4:03 PM Tom Keffer <[email protected]> wrote:

> The error seems to be peculiar to the most recent version of Pillow. If I
> hardwire in your values and use any version prior to 9.5.0, it runs without
> errors. If I use Pillow 9.5.0, I get the same error as you. I see nothing
> in the 9.5.0 release notes that mentions anything related to draws.
>
> Pillow 9.5.0 was just posted 1 April. Maybe it's an April Fool's joke?
>
> More likely, it's being stricter about the ordering of the box
> coordinates, but they didn't mention that in the release notes.
>
> What version of Pillow are you using? I assume 9.5.0
>
> *python3 -c "import PIL;print(PIL.__version__)"*
>
> and
>
>
> *python3 -m pip list | grep Pillow*
>
> I've created issue 862 <https://github.com/weewx/weewx/issues/862> to
> track.
>
> In the meantime, I'd suggest using Pillow 9.4.0.
>
> -tk
>
> On Mon, Apr 3, 2023 at 12:47 PM c s (224) <[email protected]>
> wrote:
>
>> Thank you very much! You are right! Setting the "show_daynight" in
>> skin.conf to False resolves the problem. I did not touch skin.conf before
>> and used the version as it is delivered in weewx-4.10.2.tar.gz.
>>
>> When I turn "show_daynight" on again and add your additional print
>> messages (and keep the ones I had already added before) I get the following:
>>
>> In _renderDayNight(), self.yscale = (0.0, 5.0, 0.5)
>> latitude=48.14, longitude=11.57
>> first=night, transitions=[1680497278, 1680543969]
>> Draw rectangle failed:
>> ((1680462000, 0.0), (1680497278, 5.0))
>> [(44.90740740764886, 144.5), (202.42440329305828, 24.5)]
>> self.xscale: 0.004465020576131688, self.xoffset: -7503253, self.yscale:
>> -24.0, self.yoffset: 144
>>
>> Draw rectangle failed:
>> ((1680497278, 0.0), (1680543969, 5.0))
>> [(202.42440329305828, 144.5), (410.9006790127605, 24.5)]
>> self.xscale: 0.004465020576131688, self.xoffset: -7503253, self.yscale:
>> -24.0, self.yoffset: 144
>>
>>
>> Does this tell you anything? What can I do to resolve this problem
>> (without switching this feature off)?
>>
>> As a side remark: in my installation of "WeeWX: Installation using
>> setup.py" I use the native GW1000 driver. Only in the docker image I left
>> everything as it was and continue to use the interceptor driver.
>>
>> Thank you very much!
>>
>> c s (224) schrieb am Montag, 3. April 2023 um 13:18:39 UTC+2:
>>
>>> Hello,
>>>
>>> I have just installed weewx as described here:
>>> https://weisser-zwerg.dev/posts/ecowitt-gw2000-weewx-docker
>>>
>>> And I run into an error that prevents the images from being drawn:
>>>
>>> weewx-weewx-1      | Apr  3 13:11:03 weewx[20] ERROR
>>> weewx.reportengine:         ****  Generator terminated
>>> weewx-weewx-1      | Traceback (most recent call last):
>>> weewx-weewx-1      |   File "/home/weewx/bin/weewx/reportengine.py",
>>> line 197, in run
>>> weewx-weewx-1      |     obj.start()
>>> weewx-weewx-1      |   File "/home/weewx/bin/weewx/reportengine.py",
>>> line 385, in start
>>> weewx-weewx-1      |     self.run()
>>> weewx-weewx-1      |   File "/home/weewx/bin/weewx/imagegenerator.py",
>>> line 42, in run
>>> weewx-weewx-1      |     self.gen_images(self.gen_ts)
>>> weewx-weewx-1      |   File "/home/weewx/bin/weewx/imagegenerator.py",
>>> line 114, in gen_images
>>> weewx-weewx-1      |     image = plot.render()
>>> weewx-weewx-1      |             ^^^^^^^^^^^^^
>>> weewx-weewx-1      |   File "/home/weewx/bin/weeplot/genplot.py", line
>>> 222, in render
>>> weewx-weewx-1      |     self._renderDayNight(sdraw)
>>> weewx-weewx-1      |   File "/home/weewx/bin/weeplot/genplot.py", line
>>> 266, in _renderDayNight
>>> weewx-weewx-1      |     sdraw.rectangle(((xleft,self.yscale[0]),
>>> weewx-weewx-1      |   File "/home/weewx/bin/weeplot/utilities.py",
>>> line 442, in rectangle
>>> weewx-weewx-1      |     self.draw.rectangle(box_scaled, **options)
>>> weewx-weewx-1      |   File
>>> "/opt/venv/lib/python3.11/site-packages/PIL/ImageDraw.py", line 294, in
>>> rectangle
>>> weewx-weewx-1      |     self.draw.draw_rectangle(xy, fill, 1)
>>> weewx-weewx-1      | ValueError: y1 must be greater than or equal to y0
>>>
>>> I have followed the complete set-up process as described in "WeeWX:
>>> Installation using setup.py", except that I do use a conda environment and
>>> pip packages rather than the OS packages:
>>>
>>> > mamba create -n weewx python=3.9
>>> > conda activate weewx
>>> > pip3 install configobj paho-mqtt pyserial pyusb Cheetah3 Pillow ephem
>>> > wget https://weewx.com/downloads/weewx-4.10.2.tar.gz
>>> > tar -xzvf weewx-4.10.2.tar.gz
>>> > cd weewx-4.10.2
>>> > python3 ./setup.py build
>>> > python3 ./setup.py install
>>> > # create the weewx.conf.patch from here:
>>> https://weisser-zwerg.dev/posts/ecowitt-gw2000-weewx-docker/
>>> > patch -p1 weewx.conf < weewx.conf.patch
>>> > wget -O weewx-mqtt.zip
>>> https://github.com/matthewwall/weewx-mqtt/archive/master.zip
>>> > ./bin/wee_extension --install ./weewx-mqtt.zip
>>> > wget -O weewx-interceptor.zip
>>> https://github.com/matthewwall/weewx-interceptor/archive/master.zip
>>> > ./bin/wee_extension --install ./weewx-interceptor.zip
>>> > # -------------------
>>> > ./bin/weewxd
>>>
>>> I still run into the exact same problem. I've tried several
>>> modifications to the config file, but cannot figure out what causes this
>>> problem. I've also added some print statement to tell me more about the
>>> issue around the drawing of the rectangle:
>>> def rectangle(self, box, **options):
>>> """Draw a scaled rectangle.
>>> box: A pair of 2-way tuples, containing coordinates of opposing corners
>>> of the box.
>>> options: passed on to draw.rectangle. Usually contains 'fill' (the color)
>>> """
>>> box_scaled = [(coord[0] * self.xscale + self.xoffset + 0.5,
>>> coord[1] * self.yscale + self.yoffset + 0.5) for coord in box]
>>> try:
>>> self.draw.rectangle(box_scaled, **options)
>>> print("Draw rectangle succeeded.")
>>> except:
>>> print("Draw rectangle failed:")
>>> print(box)
>>> print(box_scaled)
>>> print(f"self.xscale: {self.xscale}, self.xoffset: {self.xoffset},
>>> self.yscale: {self.yscale}, self.yoffset: {self.yoffset}\n")
>>> pass
>>>
>>> And I get results as follows:
>>> # ((1680429600, 1029.6000000000001), (1680457455, 1030.1000000000001))
>>> # [(44.01851851865649, 144.4999999999709), (216.61388888955116,
>>> 24.499999999970896)]
>>> # self.xscale: 0.004465020576131688, self.xoffset: -7503109,
>>> self.yscale: -240.0, self.yoffset: 247248
>>>
>>> Do you have any clues on how to resolve this?
>>>
>>>
>>> Thanks!
>>>
>>> --
>> 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/fa94caf5-73e2-4b40-a7b9-f56b4153894fn%40googlegroups.com
>> <https://groups.google.com/d/msgid/weewx-user/fa94caf5-73e2-4b40-a7b9-f56b4153894fn%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/CAPq0zEAGBWAVNXwV9mVzxOiw7MgeUsTZhhQeugDGWEPcvbecgg%40mail.gmail.com.

Reply via email to