pass is a reserved word. It's a statement with a meaning of its own so the python interpretor does not understand its use as a variable name.
Rename it to something else - iss_pass ? On 12/02/2020, Kevin Davis <[email protected]> wrote: > What am I missing here? > > String in my iss_all.json file: > #set global $iss_all = [["Tue Feb 11 10:54 am","SW/10","NE/9","69","6min > 45sec"],["Tue Feb 11 12:31 pm","W/10","NE/9","33","6min 16sec"],["Tue Feb > 11 02:09 pm","WNW/10","ENE/9","28","6min 3sec"],["Tue Feb 11 03:46 > pm","WNW/10","E/9","72","6min 46sec"],["Tue Feb 11 05:23 > pm","W/10","SSE/9","19","5min 0sec"],["Wed Feb 12 10:07 > am","SSW/10","ENE/9","43","6min 24sec"],["Wed Feb 12 11:44 > am","WSW/10","NE/9","41","6min 29sec"],["Wed Feb 12 01:21 > pm","WNW/10","NE/9","27","5min 57sec"],["Wed Feb 12 02:58 > pm","WNW/10","E/9","51","6min 38sec"],["Wed Feb 12 04:35 > pm","W/10","SE/9","30","6min 9sec"],["Thu Feb 13 09:20 > am","S/11","ENE/9","27","5min 40sec"],["Thu Feb 13 10:56 > am","WSW/10","NE/9","54","6min 41sec"],["Thu Feb 13 12:33 > pm","WNW/10","NE/9","27","5min 58sec"],["Thu Feb 13 02:10 > pm","WNW/10","ENE/9","39","6min 27sec"],["Thu Feb 13 03:47 > pm","W/10","SE/9","47","6min 38sec"],["Fri Feb 14 08:33 > am","SSE/10","E/9","17","4min 39sec"],["Fri Feb 14 10:08 > am","SW/10","NE/9","78","6min 47sec"],["Fri Feb 14 11:46 > am","W/10","NE/9","29","6min 4sec"],["Fri Feb 14 01:23 > pm","WNW/10","ENE/9","32","6min 12sec"],["Fri Feb 14 03:00 > pm","WNW/10","ESE/9","76","6min 47sec"],["Fri Feb 14 04:38 > pm","WSW/10","S/9","12","2min 53sec"],["Sat Feb 15 07:47 > am","SE/10","ESE/9","10","1min 39sec"],["Sat Feb 15 09:20 > am","SW/10","NE/9","69","6min 44sec"],["Sat Feb 15 10:58 > am","W/10","NE/9","33","6min 16sec"],["Sat Feb 15 12:35 > pm","WNW/10","ENE/9","28","6min 3sec"],["Sat Feb 15 02:12 > pm","WNW/10","E/9","72","6min 47sec"],["Sat Feb 15 03:49 > pm","W/10","SSE/9","19","5min 0sec"],["Sun Feb 16 08:33 > am","SSW/10","ENE/9","43","6min 23sec"],["Sun Feb 16 10:10 > am","WSW/10","NE/9","41","6min 28sec"]] > > From my iss.inc template > <table> > <tr> > <td class="label">Start Time</td> > <td class="label">Rise</td> > <td class="label">Set</td> > <td class="label">Max</td> > <td class="label">Length of Pass</td> > </tr> > #include "iss_all.json" > #for $pass in $iss_all > <tr> > <td class="data">$pass[0]</td> > <td class="data">$pass[1]</td> > <td class="data">$pass[2]</td> > <td class="data">$pass[3]</td> > <td class="data">$pass[4]</td> > </tr> > #end for > </table> > > > My error: > Feb 11 10:23:02 corbett wee_reports[31488]: **** Traceback (most recent > call last): > Feb 11 10:23:02 corbett wee_reports[31488]: **** File > "/usr/share/weewx/weewx/cheetahgenerator.py", line 332, in generate > Feb 11 10:23:02 corbett wee_reports[31488]: **** > fd.write(str(compiled_template)) > Feb 11 10:23:02 corbett wee_reports[31488]: **** File > "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in > __str__ > Feb 11 10:23:02 corbett wee_reports[31488]: **** rc = getattr(self, > mainMethName)() > Feb 11 10:23:02 corbett wee_reports[31488]: **** File > "_etc_weewx_skins_Seasons_index_html_tmpl.py", line 258, in respond > Feb 11 10:23:02 corbett wee_reports[31488]: **** File > "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1597, in > _handleCheetahInclude > Feb 11 10:23:02 corbett wee_reports[31488]: **** nestedTemplateClass = > compiler.compile(source=source, file=file) > Feb 11 10:23:02 corbett wee_reports[31488]: **** File > "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 796, in > compile > Feb 11 10:23:02 corbett wee_reports[31488]: **** raise e > Feb 11 10:23:02 corbett wee_reports[31488]: **** File > "_etc_weewx_skins_Seasons_iss_incwk.py", line 144 > Feb 11 10:23:02 corbett wee_reports[31488]: **** for pass in > VFFSL(SL,"iss_all",True): # generated from line 21, col 2 > Feb 11 10:23:02 corbett wee_reports[31488]: **** ^ > Feb 11 10:23:02 corbett wee_reports[31488]: **** SyntaxError: invalid > syntax > > On Mon, Feb 10, 2020 at 9:43 AM Kevin Davis <[email protected]> wrote: > >> Very cool. Thanks for the input. Certainly helps me to see a working >> example! >> >> On Mon, Feb 10, 2020 at 9:40 AM Walter Smith <[email protected]> wrote: >> >>> 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 >>> <https://groups.google.com/d/msgid/weewx-user/7e38d3ef-7a1c-4c6b-973a-b877ff72dc56%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/CAHiQ_B2-_QuQoCnO8OMeZC7za92BjWop55HTZ-_ww%2BKeE_-1CA%40mail.gmail.com. > -- Cheers Glenn rorpi - read only raspberry pi & various weewx addons https://github.com/glennmckechnie -- 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/CAAraAzjKOC_moeVjaO7DBXqM83afJsDCo05%2Bj752saXa-dFdKQ%40mail.gmail.com.
