Unfortunately the Cheetah templating engine takes the template and does its own 
stuff to it and generates a temporary .py file. The line numbers in 
cheetahgenerator errors that refer to a template file don't relate directly to 
the line numbers in your template but rather the temporary .py file and we 
don't have access to that file. How you troubleshoot cheetahgenerator errors 
depends on what the error is. In this case you have a clue - the python error:

May  8 08:00:20 jed164 weewx[10989]: ****  TypeError: unsupported operand 
type(s) for -: 'NoneType' and 'NoneType'

In this case somewhere in your template you have a subtraction operation and 
both operands are None. So you need to look through your template and find all 
the minus operations. Then critically look at the variables either side of the 
minus sign, work out if they could possibly be None, if they could be None then 
harden your code so that Nones are avoided or otherwise handled - try .. except 
statements can help trap such situations. Hopefully you only have one or two 
minus operators, otherwise you need to work through your template and find 
which one is the culprit. Common sources of None are using obs that exist but 
have no value (well they do exist their value is just None) or queries on the 
database that return no results.

Sometimes you might get a more informative error that might point to a line in 
a search list extension - you can use those line numbers - and these are easy 
to pin point the offending line. Sometimes you will get a more general error 
and the only real approach is to comment out half your template at a time until 
you find the portion of code with the error and then home in on the offending 
line - these errors are a real pain, especially if you have a large and complex 
template.

Gary

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to