Astral hours of darkenss - Raspberry Pi Forums


hi,

trying calculate hours of darkness, googling have found astral module can this, using 'night'.
using module @ moment in script sunrise , sunset, have used sun['night'] error keyerror: 'night'
can not find examples of night being used, don't know if i've called wrong :?: clarify?

documentation here https://pythonhosted.org/astral/

thanks
james

code: select all

#!/usr/bin/python astral import * ast = astral() location = ast['london'] nightduration = location.night() print nightduration 
gets
pi@aplus /tmp $ python nightynight.py
(datetime.datetime(2016, 11, 20, 18, 3, 1, tzinfo=<dsttzinfo 'europe/london' gmt0:00:00 std>), datetime.datetime(2016, 11, 21, 5, 30, 45, tzinfo=<dsttzinfo 'europe/london' gmt0:00:00 std>))
pi@aplus /tmp $

ever wrong compared gps receiver gives sunset: 17:10 , sunrise: 08:29


raspberrypi



Comments