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

[Bug]: Error python with 4.3.17 #588

Closed Mavialle closed 3 months ago

Mavialle commented 3 months ago

What is the bug?

I made a Lizmap project and created a cfg file with the Lizmap 4.3.0 plugin.

When I updated the Lizmap plugin to version 4.3.17, I was no longer able to use the Lizmap plugin : the plugin window opens, but when I click on the OK button a python message appears.

Here is the message :

Une erreur est survenue lors de l'exécution du code Python : 

AttributeError: 'NoneType' object has no attribute 'startswith' 
Traceback (most recent call last):
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 4283, in ok_button_clicked
    if not self.save_cfg_file_cursor():
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 4296, in save_cfg_file_cursor
    result = self.save_cfg_file()
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 4371, in save_cfg_file
    if not self.server_manager.check_lwc_version(lwc_version.value):
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\server_lwc.py", line 281, in check_lwc_version
    if lwc_version.startswith(version_check):
AttributeError: 'NoneType' object has no attribute 'startswith'

Version de Python : 3.9.18 (heads/master:c290dc6, Jan 14 2024, 01:36:02) [MSC v.1929 64 bit (AMD64)] 
Version de QGIS : 3.28.15-Firenze Firenze, 252ad49ddc 

Chemin Python :
C:/PROGRA~1/QGIS32~1.15/apps/qgis-ltr/./python
C:/Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS32~1.15/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS32~1.15\apps\grass\grass83\etc\python
C:\Users\tigeo\Documents
C:\Program Files\QGIS 3.28.15\bin\python39.zip
C:\PROGRA~1\QGIS32~1.15\apps\Python39\DLLs
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib
C:\Program Files\QGIS 3.28.15\bin
C:\PROGRA~1\QGIS32~1.15\apps\Python39
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages\win32
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages\Pythonwin
C:/Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:\Users\tigeo\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\DigitizingTools\tools
C:\Users\tigeo\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\DigitizingTools
C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\excel_sync\libs\xlrd-1.2.0-py2.py3-none-any.whl
C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\excel_sync\libs\xlwt-1.3.0-py2.py3-none-any.whl
C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\go2streetview
C:\Users\tigeo\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\go2streetview\res
C:/Dropbox/1_ACTIONS/4_PLATEFORME/8b_NEW_LIZMAP/test

Versions, safeguards, checks summary etc

Versions :

Lizmap Web Client : 3.7.5 Lizmap plugin : 4.3.0 QGIS Desktop : 3.28.15 QGIS Server : 3.28.15 Py-QGIS-Server : not used QGIS Server plugin atlasprint : 3.3.2 QGIS Server plugin cadastre : 1.19.1 QGIS Server plugin lizmap_server : 2.8.6 QGIS Server plugin wfsOutputExtension : 1.8.0

Check Lizmap plugin

Gustry commented 3 months ago

Can you please press the "blue arrows" at the bottom of the table ? How many servers do you have ? Are they all reachable ?

I guess pressing the blue arrows under the table will fix the issue. (inthe meantime I find a proper fix)

Mavialle commented 3 months ago

I have 3 servers, all with the same versions (docker deployment)

I pressed the "blue arrows" at the bottom of the plugin panel, information section, and I have a new message, see below.

In the list of servers, "action" column, I have a message for the 3 servers which says "Not the latest bugfix version. 3.7.8 is available". But this message already existed when I was using version 7.3 of the plugin, and it didn't cause any problems.

If you need additional information, do not hesitate to get back to me

Error message : 
ValueError: invalid literal for int() with base 10: '.1' 
Traceback (most recent call last):
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 4283, in ok_button_clicked
    if not self.save_cfg_file_cursor():
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 4296, in save_cfg_file_cursor
    result = self.save_cfg_file()
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 4433, in save_cfg_file
    if not self.write_project_config_file(lwc_version, with_gui):
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 3018, in write_project_config_file
    liz2json = self.project_config_file(lwc_version, with_gui)
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 3565, in project_config_file
    if not self.check_project(lwc_version, with_gui, check_server, ignore_error):
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\plugin.py", line 3499, in check_project
    min_required_version = format_qgis_version(min_required_version, increase_odd_number=False)
  File "C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\lizmap\toolbelt\version.py", line 36, in format_qgis_version
    minor = int(qgis_version[1:3])
ValueError: invalid literal for int() with base 10: '.1'

Version de Python : 3.9.18 (heads/master:c290dc6, Jan 14 2024, 01:36:02) [MSC v.1929 64 bit (AMD64)] 
Version de QGIS : 3.28.15-Firenze Firenze, 252ad49ddc 

Chemin Python :
C:/PROGRA~1/QGIS32~1.15/apps/qgis-ltr/./python
C:/Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS32~1.15/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS32~1.15\apps\grass\grass83\etc\python
C:\Users\tigeo\Documents
C:\Program Files\QGIS 3.28.15\bin\python39.zip
C:\PROGRA~1\QGIS32~1.15\apps\Python39\DLLs
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib
C:\Program Files\QGIS 3.28.15\bin
C:\PROGRA~1\QGIS32~1.15\apps\Python39
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages\win32
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS32~1.15\apps\Python39\lib\site-packages\Pythonwin
C:/Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:\Users\tigeo\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\DigitizingTools\tools
C:\Users\tigeo\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\DigitizingTools
C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\excel_sync\libs\xlrd-1.2.0-py2.py3-none-any.whl
C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\excel_sync\libs\xlwt-1.3.0-py2.py3-none-any.whl
C:\Users/tigeo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\go2streetview
C:\Users\tigeo\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\go2streetview\res
C:/Dropbox/1_ACTIONS/4_PLATEFORME/8b_NEW_LIZMAP/test
Gustry commented 3 months ago

I don't understand how you got this Python error...

Can you :

  1. log in as an admin in your web browser ?
  2. Get back to the home page of Lizmap, append index.php/view/app/metadata at the end, you should have a JSON file
  3. Can you give your value of lizmap_desktop_plugin_version ?

Or QGIS → Settings → User profile → Open Active Profile folder → Lizmap directory → cache_server_metadata, open your current server JSON and do step 3 in the file.

Mavialle commented 3 months ago

I updated the Lizmap plugin in QGIS to version 4.3.18 and it works!

I close the ticket. Thanks for your help.