add-apt-repository does not work after updating to Python 3.9

add-apt-repository does not work after updating to Python 3.9

If you are using Python 3.9, you might get the following error when running the add-apt-repository command:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 191, in <module>
    if not sp.add_source_from_shortcut(shortcut, options.enable_source):
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 777, in add_source_from_shortcut
    if worker.is_live():
AttributeError: 'Thread' object has no attribute 'is_live'

The reason is that from Python 3.9, isAlive() method was removed, and replaced by is_alive().  Source.

To temporarily fix this issue, edit the file /usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py, at line 777, change isAlive() to is_alive().

Buy Me A Coffee