3liz / lizmap-plugin

Lizmap plugin for QGIS, allowing to publish QGIS maps to Lizmap Web Client
https://www.lizmap.com/
GNU General Public License v2.0
62 stars 31 forks source link

AttributeError: 'NoneType' object has no attribute 'get' #481

Closed gioman closed 1 year ago

gioman commented 1 year ago

Description

AttributeError: 'NoneType' object has no attribute 'get' 
Traceback (most recent call last):
  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 3151, in save_cfg_file
    self.write_project_config_file()
  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 2585, in write_project_config_file
    if is_lizmap_dot_com_hosting(server_metadata):
  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\saas.py", line 21, in is_lizmap_dot_com_hosting
    return metadata.get('hosting', '') == 'lizmap.com'
AttributeError: 'NoneType' object has no attribute 'get'

Context

gioman commented 1 year ago

Had to revert to 3.10.1 as 3.11.0 gives the above error regardless of the project/data.

Gustry commented 1 year ago

This code has been introduced in 3.10.0 so before the version you are releasing.

Reading the changelog between 3.10.1 and 3.11.0, I don't see anything.

I suspect your were using Lizmap with a missing "signal" when it's fetching the metadata from your server.

I guess you can upgrade again and just try to check your server list, does all server as a QGIS server version ?

gioman commented 1 year ago

@Gustry seems you are right.

Gustry commented 1 year ago

Thanks for the feedback.

There is still an issue somewhere, you shouldn't have a Python error displayed. So there is somewhere I should add some safe-guard. Your server must has been "ready" (with metadata fetched) before pressing OK button from Lizmap. It's a matter of a few ms or second I guess. I will think about that.

Gustry commented 1 year ago

Slightly improved in the coming latest bugfix 3.11.1