Doing something very similar. Cron job at midnight, Python script to
format a list of stuff from Skyfield I want to display in my template.
Prefix the list with a "#set global" line:
with open('skyprint2A.txt','w') as f3:
f3.write('#set global $skytext2 = ')
json.dump(l_out_lines_txt, f3)
which gives a file containing:
#set global $skytext2 = [["Mon Feb 10", "06:57 AM", "Sun Rises 01:08
earlier Length of Day 10:30:46 02:19 longer"], ["Mon Feb 10", "07:41 AM",
"Mercury Rises 52% Illuminated"], ["Mon Feb 10", "08:08 AM", "Moon Sets"],
["Mon Feb 10", "08:42 AM", "Venus Rises 70% Illuminated"], ["Mon Feb 10",
"05:28 PM", "Sun Sets 01:11 later"], ["Mon Feb 10", "07:01 PM", "Mercury
Sets"], ["Mon Feb 10", "07:20 PM", "Moon Rises 95% Illuminated"], ["Mon
Feb 10", "08:59 PM", "Venus Sets"], ["Tue Feb 11", "06:56 AM", "Sun Rises
01:10 earlier Length of Day 10:33:07 02:21 longer"], ["Tue Feb 11", "07:38
AM", "Mercury Rises 47% Illuminated"], ["Tue Feb 11", "08:41 AM", "Venus
Rises 70% Illuminated"], ["Tue Feb 11", "08:43 AM", "Moon Sets"], ["Tue
Feb 11", "05:29 PM", "Sun Sets 01:11 later"], ["Tue Feb 11", "07:02 PM",
"Mercury Sets"], ["Tue Feb 11", "08:34 PM", "Moon Rises 89% Illuminated"],
["Tue Feb 11", "09:01 PM", "Venus Sets"], ["Sat Feb 15", "04:17 PM", "Moon
Phase Last Quarter"], ["Thu Mar 19", "10:49 PM", "Vernal Equinox"]]
then in my template:
#include "skyprint2A.txt"
Sky Events
<table>
<tr>
<td>Date</td>
<td>Time</td>
<td>Event</td>
</tr>
#for $seq1 in $skytext2
<tr>
<td>$seq1[0]</td>
<td>$seq1[1]</td>
<td>$seq1[2]</td>
</tr>
#end for
</table>
--
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/7e38d3ef-7a1c-4c6b-973a-b877ff72dc56%40googlegroups.com.