Question

<?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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top