ty-porter / PiClock

A clock integrating weather data from AccuWeather using the magic of RasPi
MIT License
9 stars 4 forks source link

Unorderable Types Error on Startup #9

Open jprucks opened 5 years ago

jprucks commented 5 years ago

Recently updated to the new version with the graph. Got through some minor issues, but now I'm stuck on this error:

pi@raspberrypi_matrix:~/PiClock $ sudo python3 ./PiClock.py --led-rows=64 --led-cols=64 --led-chain=2 -m=adafruit-hat-pwm 
10/18/19 18:06:26 : Generating current weather data from AccuWeather...
10/18/19 18:06:26 : Generating forecast data from AccuWeather...
[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 81]
Press CTRL-C to stop execution
Traceback (most recent call last):
  File "./PiClock.py", line 399, in <module>
    if (not piClock.process()):
  File "/home/pi/PiClock/appbase.py", line 73, in process
    self.run()
  File "./PiClock.py", line 338, in run
    maxTemp = max(self.tempHistory)
TypeError: unorderable types: NoneType() > NoneType()

I'm not sure how to approach it. I have a gist of why it's throwing the error, but not enough to fix it. Thanks again for the project!

jprucks commented 5 years ago

I was able to get it to run by placing a zero in place of "None" on Line 31. Predictably, the minimum temperature displayed is zero. The list of values displayed in the terminal (after this change) are [0,0,0,...,0,81].

Again, I have poor programming skills and I don't know the language, but hopefully this will help you diagnose the cause of the issue.


I just realized that the graph is of temperature, not precip chance (as you'd see with the DarkSky API). Bummer. I guess that would be a feature I'd like to request! I updated it because I thought the graph was like the 1hr precip probability graph I have on a Magic Mirror. It's very useful in Florida.

ty-porter commented 4 years ago

Thanks for the issue, sorry it took so long to investigate.

Originally I did use 0 as indicator for temp history not being present, but the problem with that is that it's entirely possible to have 0 degrees as a temperature and so it ends up being impossible to parse out what a 0 temp means vs. None temp. This throws off the scaling of the graph (for places colder than 0 it causes the temp to look like it's dropping).

Apparently calling max() on an array containing None was breaking your display? The solution I can think of off the top of my head is to manually compute the maxTemp (skipping None values) instead of relying on built-in functions to do this.

As far as your precip request, it seems doable, whenever I find the time!