neowx-material icon indicating copy to clipboard operation
neowx-material copied to clipboard

Fix Cheetah error

Open uajqq opened this issue 4 years ago • 7 comments

Fixes #30 and #40

uajqq avatar Dec 28 '21 22:12 uajqq

Same issue on my server.

This PR needs to be merged into the repository.

kbahey avatar Dec 24 '24 14:12 kbahey

I'm not sure about your changes see https://discuss.python.org/t/why-is-it-better-to-write-if-a-is-none-instead-of-if-a-none/42203 is not None should be better than != None

This repo is not maintained anymore... I added latest changes and PR to this fork https://github.com/seehase/neowx-material

seehausen avatar Dec 24 '24 16:12 seehausen

The issue is not about

is not None

Rather it is about:

is not 

And should be replaced with:

!= 

The exact error message is:

SyntaxWarning: "is not" with 'str' literal. Did you mean "!="

Replacing all the 'is not' with '!=' solves the issue.

kbahey avatar Dec 24 '24 16:12 kbahey

but all your changed files replaces is not None with != None or do I get it wrong, and in this case is not None would be correct

seehausen avatar Dec 24 '24 16:12 seehausen

My guess is that you are right. But the Cheetah Engine may be doing things differently or imposing a more strict syntax.

I ended up doing a global search and replace on all the *.tmpl files, and the warning went away.

kbahey avatar Dec 24 '24 16:12 kbahey

OK, i don't cheetah very well, but I cannot see the errors you have could it be maybe a wrong version I have CHEETAH 3.2.6 and using the is not None in my templates

seehausen avatar Dec 24 '24 18:12 seehausen

My version of Cheetah is newer. It is 3.3.3, from the Ubuntu 24.04 LTS repositories.

And my python is 3.12.3.

kbahey avatar Dec 24 '24 18:12 kbahey