imDMG / qBt_SE

qBittorrent search engine plugins
MIT License
97 stars 28 forks source link

Avoid AttributeError: 'NoneType' object has no attribute 'get' #16

Closed mavaddat closed 2 years ago

mavaddat commented 2 years ago

This fixes the issue where, on Python 3.10.4, the following traceback is being generated when trying to run settings_gui.py without type checking:


Traceback (most recent call last):
  File "%USERPROFILE%\AppData\Local\qBittorrent\nova3\settings_gui.py", line 116, in <module>
    settings = EngineSettingsGUI("engines/kinozal")
  File "%USERPROFILE%\AppData\Local\qBittorrent\nova3\settings_gui.py", line 25, in __init__
    value=self.config.get("proxies").get("http", "")
AttributeError: 'NoneType' object has no attribute 'get'
imDMG commented 2 years ago

Yes, but class Config has method _validate_json that fix invalid json file.

mavaddat commented 2 years ago

Yes, but class Config has method _validate_json that fix invalid json file.

This PR was not about invalid JSON though. It was about strong-typing requirements in Python 3.