0

While installing Brightness Controller from its ppa in Ubuntu 20.04, it shows an invalid syntax error

Setting up brightness-controller (2.3.4-0~202004250741~ubuntu20.04.1) ...
  File "/usr/share/brightness-controller/util/write_config.py", line 21
    def _default_config(config, display_type: str = 'primary'):
                                            ^
SyntaxError: invalid syntax

dpkg: error processing package brightness-controller (--configure):
 installed brightness-controller package post-installation script subprocess returned error exit status 101

However, when I run the python file directly from the source code, it does not show any error. Despite showing this error during installation, the program does install, and runs correctly and does not print any syntax error (when called from terminal) when the relevant functions of write_config.py is called.

Any idea why dpkg shows an syntax error of a Python file and Python itself does not show any error? And how to fix it?

2
  • Note: I am the package maintainer of this software, and I am not sure why this is happening. Apr 25, 2020 at 18:11
  • 1
    Looks like a python2 versus python3 issue to me (the : introduces a function annotation )? Apr 25, 2020 at 19:01

1 Answer 1

1

It turned out that dpkg does not recognize str, and removing this typehint fixed the error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .