Solved it. != works where <> doesn't anymore. There's apparently a 
difference between how Python 2 and Python 3 compares strings.

 #if $day.dateTime.format("%Y")!=$year.dateTime.format("%Y")  
On Sunday, November 15, 2020 at 8:58:15 AM UTC-8 [email protected] wrote:

> I'm in the process of moving my station from an old version of Rasbian and 
> Python 2 to the current version of Debian with Python 3. I'm doing it on 
> different hardware so I can port over my customizations a piece at a time.
>
> I am using the search extension from here: 
> https://github.com/gjr80/weewx_utilities/tree/master/search%20list%20extensions/this/bin/user
>  
> so I can get the high/low temps and rain from previous years on the 
> current date. That's all working. What I don't want is to show again the 
> current day's value again. It's redundant. I put in a if statement that 
> works fine on my Weewx 4.1/python 2 system but fails with 4.2 python 3.
>
>  #if $day.dateTime.format("%Y")<>$year.dateTime.format("%Y")
>
> Log file says:
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: Generate 
> failed with exception '<class 'SyntaxError'>'
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: **** 
> Ignoring template /etc/weewx/skins/Standard/index.html.tmpl
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: **** 
> Reason: invalid syntax 
> (cheetah__etc_weewx_skins_Standard_index_html_tmpl_1605459018_6379018_60306.py,
>  
> line 1434)
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****  
> Traceback (most recent call last):
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 827, in 
> compile
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> parseError = genParserErrorFromPythonException(
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 2045, in 
> genParserErrorFromPythonException
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> reader = SourceReader(source, filename=filename)
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/lib/python3/dist-packages/Cheetah/SourceReader.py", line 19, in 
> __init__
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> self._srcLen = len(src)
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****  
> TypeError: object of type 'NoneType' has no len()
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****  
> During handling of the above exception, another exception occurred:
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****  
> Traceback (most recent call last):
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/share/weewx/weewx/cheetahgenerator.py", line 315, in generate
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> compiled_template = Cheetah.Template.Template(
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1337, in 
> __init__
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> self._compile(source, file, compilerSettings=compilerSettings)
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1634, in 
> _compile
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> templateClass = self.compile(source, file,
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 832, in 
> compile
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> raise e
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 823, in 
> compile
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> co = compile(generatedModuleCode, __file__, 'exec')
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****    
> File 
> "cheetah__etc_weewx_skins_Standard_index_html_tmpl_1605459018_6379018_60306.py",
>  
> line 1434
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
> if 
> VFN(VFFSL(SL,"day.dateTime",True),"format",False)("%Y")<>VFN(VFFSL(SL,"year.dateTime",True),"format",False)("%Y"):
>  
> # generated from line 346, col 22
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****      
>                                                            ^
> Nov 15 08:50:18 raspi3 weewx[6772] ERROR weewx.cheetahgenerator: ****  
> SyntaxError: invalid syntax
> Nov 15 08:50:19 raspi3 weewx[6772] INFO weewx.cheetahgenerator: Generated 
> 13 files for report StandardReport in 2.63 seconds
>
> Any ideas?
> I've confirmed that both 
> $year.dateTime.format("%Y")
> and
> $day.dateTime.format("%Y")
> will  appear the HTML page as the correct values. Neither is 
> null/nothing/0 length.
>
>

-- 
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/eaea8f06-5f2a-484e-8686-59e4da28f199n%40googlegroups.com.

Reply via email to