Skip to content

QGIS 3.40 and Dataplotty 4.3.1 : python error on layout #379

Closed

Description

@palight

Describe

I have a project with a report wich contains several plots (bar, histogram, scatter, but no radar plot). Since update from 4.2.0 to 4.3.1, when I open the report I got a python error about radar plot (that I don't use)

KeyError: 'y_combo_radar_label' 
Traceback (most recent call last):
  File "C:\Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 157, in draw
    self.load_content()
  File "C:\Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 223, in load_content
    self.web_page.mainFrame().setHtml(self.create_plot(), base_url)
                                      ^^^^^^^^^^^^^^^^^^
  File "C:\Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 189, in create_plot
    plot_factory = PlotFactory(self.plot_settings[0], self, polygon_filter=polygon_filter)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\DataPlotly\core\plot_factory.py", line 117, in __init__
    self.rebuild()
  File "C:\Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\DataPlotly\core\plot_factory.py", line 477, in rebuild
    self.fetch_values_from_layer()
  File "C:\Users/xxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\DataPlotly\core\plot_factory.py", line 167, in fetch_values_from_layer
    self.settings.properties[
KeyError: 'y_combo_radar_label'

Reproduce
Steps to reproduce the behavior:

  1. Open project with report containing plots
  2. Then open the report and see the pyhton error and Qgis closing

Screenshots

none, error seems enough

Desktop (please complete the following information):

  • OS: Windows 11
  • QGIS release 3.40.6
  • DataPlotly 4.3.1

Activity

  1. ghtmtt commented on Jul 9, 2025

    @ghtmtt
    Owner

    @soaubier can you please have a look at this? Thanks!

  2. soaubier commented on Jul 15, 2025

    @soaubier
    Contributor

    Yes, I'll take it @ghtmtt !

    @palight can you give me a test project, please? It will be easier to check. Thanks !

  3. pigreco commented on Aug 22, 2025

    @pigreco

    I confirm, I get the same message.

    KeyError: 'y_combo_radar_label' 
    Traceback (most recent call last):
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 157, in draw
        self.load_content()
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 223, in load_content
        self.web_page.mainFrame().setHtml(self.create_plot(), base_url)
                                          ^^^^^^^^^^^^^^^^^^
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 181, in create_plot
        plot_factory = PlotFactory(self.plot_settings[0], self, polygon_filter=polygon_filter)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\core\plot_factory.py", line 117, in __init__
        self.rebuild()
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\core\plot_factory.py", line 477, in rebuild
        self.fetch_values_from_layer()
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\core\plot_factory.py", line 167, in fetch_values_from_layer
        self.settings.properties[
    KeyError: 'y_combo_radar_label'
    
    
    Versione Python: 3.12.10 (main, Apr  9 2025, 08:14:47) [MSC v.1943 64 bit (AMD64)] 
    Versione di QGIS: 3.40.5-Bratislava Bratislava, 8d6d1b5448 
    
    Percorso Python:
    C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\TocTable-main
    C:/OSGeo4W/apps/qgis-ltr/./python
    C:/Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python
    C:/Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins
    C:/OSGeo4W/apps/qgis-ltr/./python/plugins
    C:\OSGeo4W\bin\python312.zip
    C:\OSGeo4W\apps\Python312\DLLs
    C:\OSGeo4W\apps\Python312\Lib
    C:\OSGeo4W\bin
    C:\OSGeo4W\apps\Python312
    C:\OSGeo4W\apps\Python312\Lib\site-packages
    C:/Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python
    D:/P21G1466-34-v1_CUSRAS25k_analisi_cambiamenti/CUSRAS25k_13_16_19_22
    
  4. pigreco commented on Aug 22, 2025

    @pigreco

    I uninstalled the 4.3.1 plugin and installed version 4.2.0 and I still get the same error!

    oops, after restarting QGIS it works!! (DataPlotly 4.2.0)

  5. palight commented on Aug 25, 2025

    @palight
    Author

    Hi Pigreco,

    Can you prepare the test project ? My project is quite complex with mainly confidential data.

    Thanks for reporting th issue too.

    I confirm, I get the same message.

    KeyError: 'y_combo_radar_label' 
    Traceback (most recent call last):
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 157, in draw
        self.load_content()
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 223, in load_content
        self.web_page.mainFrame().setHtml(self.create_plot(), base_url)
                                          ^^^^^^^^^^^^^^^^^^
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 181, in create_plot
        plot_factory = PlotFactory(self.plot_settings[0], self, polygon_filter=polygon_filter)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\core\plot_factory.py", line 117, in __init__
        self.rebuild()
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\core\plot_factory.py", line 477, in rebuild
        self.fetch_values_from_layer()
      File "C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\DataPlotly\core\plot_factory.py", line 167, in fetch_values_from_layer
        self.settings.properties[
    KeyError: 'y_combo_radar_label'
    
    
    Versione Python: 3.12.10 (main, Apr  9 2025, 08:14:47) [MSC v.1943 64 bit (AMD64)] 
    Versione di QGIS: 3.40.5-Bratislava Bratislava, 8d6d1b5448 
    
    Percorso Python:
    C:\Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins\TocTable-main
    C:/OSGeo4W/apps/qgis-ltr/./python
    C:/Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python
    C:/Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python/plugins
    C:/OSGeo4W/apps/qgis-ltr/./python/plugins
    C:\OSGeo4W\bin\python312.zip
    C:\OSGeo4W\apps\Python312\DLLs
    C:\OSGeo4W\apps\Python312\Lib
    C:\OSGeo4W\bin
    C:\OSGeo4W\apps\Python312
    C:\OSGeo4W\apps\Python312\Lib\site-packages
    C:/Users/s.fiandaca/AppData/Roaming/QGIS/QGIS3\profiles\Corso_DTA/python
    D:/P21G1466-34-v1_CUSRAS25k_analisi_cambiamenti/CUSRAS25k_13_16_19_22
    
  6. changed the title [-]QGIS 3.40 and Dataplotty 4.3.1 : Long loading project and python error on layout[/-] [+]QGIS 3.40 and Dataplotty 4.3.1 : python error on layout[/+] on Aug 25, 2025
  7. pigreco commented on Aug 25, 2025

    @pigreco

    @soaubier , @palight , @ghtmtt
    I have attached a sample project created with QGIS 3.40 using the plugin DataPlotly 4.2.0.
    When I open the same project in QGIS 3.40 but with a different profile, where DataPlotly 4.3.1 is installed, the BarPlot diagram is no longer displayed in the print layout.

    The following error appears in the log:

    KeyError: 'y_combo_radar_label' 
    Traceback (most recent call last):
      File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 157, in draw
        self.load_content()
      File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 223, in load_content
        self.web_page.mainFrame().setHtml(self.create_plot(), base_url)
                                          ^^^^^^^^^^^^^^^^^^
      File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python/plugins\DataPlotly\layouts\plot_layout_item.py", line 181, in create_plot
        plot_factory = PlotFactory(self.plot_settings[0], self, polygon_filter=polygon_filter)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python/plugins\DataPlotly\core\plot_factory.py", line 117, in __init__
        self.rebuild()
      File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python/plugins\DataPlotly\core\plot_factory.py", line 477, in rebuild
        self.fetch_values_from_layer()
      File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python/plugins\DataPlotly\core\plot_factory.py", line 167, in fetch_values_from_layer
        self.settings.properties[
    KeyError: 'y_combo_radar_label'
    
    
    Versione Python: 3.12.11 (main, Jun 17 2025, 13:41:12) [MSC v.1943 64 bit (AMD64)] 
    Versione di QGIS: 3.40.10-Bratislava Bratislava, c98da2e682 
    
    Percorso Python:
    C:/OSGeo4W/apps/qgis-ltr/./python
    C:/Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python
    C:/Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python/plugins
    C:/OSGeo4W/apps/qgis-ltr/./python/plugins
    C:\OSGeo4W\bin\python312.zip
    C:\OSGeo4W\apps\Python312\DLLs
    C:\OSGeo4W\apps\Python312\Lib
    C:\OSGeo4W\bin
    C:\OSGeo4W\apps\Python312
    C:\OSGeo4W\apps\Python312\Lib\site-packages
    C:\OSGeo4W\apps\Python312\Lib\site-packages\win32
    C:\OSGeo4W\apps\Python312\Lib\site-packages\win32\lib
    C:\OSGeo4W\apps\Python312\Lib\site-packages\Pythonwin
    C:/Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\Corso_TESSPA/python
    

    Steps to reproduce

    1. Open the attached project in QGIS 3.40 with DataPlotly 4.2.0 → the BarPlot diagram is correctly displayed in the layout.
    2. Open the same project in QGIS 3.40 with DataPlotly 4.3.1 → the BarPlot diagram is missing in the layout.

    Expected behavior
    The BarPlot diagram should be displayed correctly also when using DataPlotly 4.3.1.

    Image

    test_dataplotly.zip

  8. ghtmtt commented on Sep 24, 2025

    @ghtmtt
    Owner

    fixed by #385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions