zb3 / gnome-gamma-tool

A command-line tool that lets you change gamma in GNOME and Cinnamon (with Wayland). You can also adjust contrast and brightness. It works by creating a color profile with the VCGT table, so that changes are persistent and don't interfere with other settings like night light.
110 stars 10 forks source link

Fails in python3 works in python2 #10

Closed sammypanda closed 1 year ago

sammypanda commented 1 year ago

thank you, this is a life saver.. just noting here that it doesn't appear to work in python 3.7.5

  File "./gnome-gamma-tool.py", line 73
    if fit and (maxval := max(val)) > 1:  # the walrus operator says hello
                       ^
SyntaxError: invalid syntax

(works for me in python 2.7.18)

zb3 commented 1 year ago

Yeah, the walrus operator was added in Python 3.8. While the reason for you using this old version of python is not my business, the only solution is a workaround in this case, as this is not a bug in ggt.

Try changing:

    if fit and (maxval := max(val)) > 1:  # the walrus operator says hello
        val = list(map(lambda x: x / maxval, val))

to

    if fit:
        maxval = max(val)
        if maxval > 1:
            val = list(map(lambda x: x / maxval, val))
sammypanda commented 1 year ago

solved, could maybe have python3 requirement added to readme