Reading a one line file within index.html.tmpl

29 views
Skip to first unread message

WindnFog

unread,
Feb 10, 2021, 2:22:44 PM2/10/21
to weewx-user
I have a one-line text file containing 4 characters.  It changes from time to time and I want to read it from Cheetah/Python 3.  The code below doesn't work, and I am wondering if I am going down the rabbit hole trying to get these 4 characters into my eventual index .html for upload:

        #with open('/path_to/length.txt','r') as file:
        #set $length = file.read()
        #$length

If there isn't a quick fix, I can try another approach.  I *seems* like it should be simple, but doesn't everything?  Am I missing the obvious?

- Paul VE1DX

p q

unread,
Feb 10, 2021, 2:43:19 PM2/10/21
to weewx...@googlegroups.com
Are you going to do something with those characters or just display them?

You could just include the file as HTML if its simple text to display. No cheetah needed. 

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/0e1329d8-2228-4f98-a9e6-f69205277404n%40googlegroups.com.

Paul Dunphy

unread,
Feb 10, 2021, 2:54:42 PM2/10/21
to weewx...@googlegroups.com
Just want to display them!  I knew I was going down the rabbit hole.  The include solution works for me.  Thanks!

- Paul VE1DX
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/_eBlhnO1Vps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAA1SM22qye4_%3DJZ8UkRwxpGposybR_kHcxDDeege8H7ePGnFSw%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages