3liz / qgis-plugin-manager

CLI tools for installing QGIS Plugins
GNU General Public License v3.0
12 stars 2 forks source link

AttributeError: 'NoneType' object has no attribute 'items' with search command #30

Closed dmarteau closed 2 years ago

dmarteau commented 2 years ago

Executing the command: qgis-plugin-manager search whatever-you-put-in raise exception:

No remote repositories found !
Traceback (most recent call last):
  File "/usr/local/bin/qgis-plugin-manager", line 8, in <module>
    sys.exit(main())
  File "/opt/local/pyqgisserver/lib/python3.9/site-packages/qgis_plugin_manager/__main__.py", line 113, in main
    results = remote.search(args.plugin_name)
  File "/opt/local/pyqgisserver/lib/python3.9/site-packages/qgis_plugin_manager/remote.py", line 235, in search
    for plugin_name, plugin in self.list_plugins.items():
AttributeError: 'NoneType' object has no attribute 'items'
Gustry commented 2 years ago

No remote repositories found !

Because you first need to add a remote repository. Look at the init command. The program should have exited after this instruction.

dmarteau commented 2 years ago

I have done the qgis-plugin-manager init and the search command worked as expected.

But AMHA it would be much better to avoid exception failure if no repository are available.

dmarteau commented 2 years ago

Also noticed that once a crash has occured then qgis-plugin-manager never recover from its first crash:

In a new environment (no init)

  1. qgis-plugin-manager search lizmap -> crash
  2. qgis-plugin-manager search init ->
    QGIS server version : 3.22.7
    Init https://plugins.qgis.org
  3. qgis-plugin-manager search lizmap ->
    File "/usr/local/bin/qgis-plugin-manager", line 8, in <module>
    sys.exit(main())
    File "/opt/local/pyqgisserver/lib/python3.9/site-packages/qgis_plugin_manager/__main__.py", line 113, in main
    results = remote.search(args.plugin_name)
    File "/opt/local/pyqgisserver/lib/python3.9/site-packages/qgis_plugin_manager/remote.py", line 235, in search
    for plugin_name, plugin in self.list_plugins.items():
    AttributeError: 'NoneType' object has no attribute 'items'
Gustry commented 2 years ago

But AMHA it would be much better to avoid exception failure if no repository are available.

Yes of course. It was what I said, the program should have properly exited when no repositories was found.

Have you done the update otherwise repositories are not fetched, like in APT

Gustry commented 2 years ago

Fixed in 1.1.2 which was released just now