Genshi TemplateSyntaxError on python block where it should work

250 Views Asked by At
<?python class += 1 ?>

One really simple line of code which definitely should work, but still it gives me this error:

TemplateSyntaxError: invalid syntax (file.html, line 22)

I shorted the filepath for readability, but that's the exact error. I'm definitely sure it should work, as I've used

<?python
    i += 1
?>

In another file, and it worked just fine there. Almost exact same structure; a table and a py:for loop. Tried everything, but can't get it to work! Any help?

1

There are 1 best solutions below

1
On BEST ANSWER

class is a Python keyword. You can't name a variable that.