Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.73k stars 445 forks source link

[main] an error appear in logs: TypeError: 'NoneType' object is not iterable (in DownloadManager.set_proxy_settings) #8040

Closed kozlovsky closed 1 month ago

kozlovsky commented 1 month ago

In the main branch, the following traceback appears in logs after #8033:

ERROR <download_manager:391> DownloadManager.set_proxy_settings(): 'NoneType' object is not iterable
Traceback (most recent call last):
  File "C:\dev\tribler\src\tribler\core\components\libtorrent\download_manager\download_manager.py", line 384, in set_proxy_settings
    if not all(v is not None for v in auth):
TypeError: 'NoneType' object is not iterable

It appears here:

        try:
            if not all(v is not None for v in auth):
                raise ValueError('Username and password should not be None')

            username, proxy_password = auth
            settings["proxy_username"] = username
            settings["proxy_password"] = proxy_password
        except (ValueError, TypeError) as e:
            self._logger.exception(e)

This is actually not an unhandled error but a part of a normal process, but it looks confusing. In a normal situation, the process should not write errors to the stderr and to the error log. I suggest handling it without raising an error.