3liz / QuickOSM

QGIS plugin to fetch OSM data with the Overpass API
GNU General Public License v2.0
180 stars 54 forks source link

QuickOSM Query Plugin Shows Attribute Error #443

Closed mKIRArasif closed 1 year ago

mKIRArasif commented 1 year ago

Help me out here, please. After connecting some data source GeoPackage file, when I try to open the QuickOSM Query window from the toolbar, it shows "Python error: An error has occurred while executing Python code: See message log (Python Error) for more details." followed by Stack trace and View message log button. When I click on Stack trace, it shows:

An error has occurred while executing Python code: 

AttributeError: 'tuple' object has no attribute 'label' 
Traceback (most recent call last):
  File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/quick_osm.py", line 253, in open_dialog
    dialog = Dialog()
             ^^^^^^^^
  File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/dialog.py", line 205, in __init__
    panel.setup_panel()
  File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/quick_query_panel.py", line 69, in setup_panel
    super().setup_panel()
  File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/base_overpass_panel.py", line 43, in setup_panel
    super().setup_panel()
  File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/base_processing_panel.py", line 83, in setup_panel
    Format.GeoPackage.value.label, Format.GeoPackage)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'label'

Python version: 3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] 
QGIS version: 3.28.2-Firenze Firenze, exported 

Python Path:
/usr/share/qgis/python
/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python
/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib64/python311.zip
/usr/lib64/python3.11
/usr/lib64/python3.11/lib-dynload
/usr/lib64/python3.11/site-packages
/usr/lib/python3.11/site-packages
/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python

When I checked the Python error message log, it showed:

2023-01-28T20:16:16     WARNING    Traceback (most recent call last):
              File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/quick_osm.py", line 253, in open_dialog
              dialog = Dialog()
              ^^^^^^^^
              File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/dialog.py", line 205, in __init__
              panel.setup_panel()
              File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/quick_query_panel.py", line 69, in setup_panel
              super().setup_panel()
              File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/base_overpass_panel.py", line 43, in setup_panel
              super().setup_panel()
              File "/home/ashik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/ui/base_processing_panel.py", line 83, in setup_panel
              Format.GeoPackage.value.label, Format.GeoPackage)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             AttributeError: 'tuple' object has no attribute 'label'

How do I fix these problems?

Environment:

Gustry commented 1 year ago

I couldn't replicate your issue : either manually in QGIS or by reading the code.

Please describe what each step ? Can you replicate everytime ? Can you install the latest version (available in a few minutes 2.2.0)

elandorr commented 1 year ago

Can be reproduced every time on Debian/testing.

et voila, breaking error

Where is the 2.2.0 for testing?

mKIRArasif commented 1 year ago

I couldn't replicate your issue : either manually in QGIS or by reading the code.

Please describe what each step ? Can you replicate everytime ? Can you install the latest version (available in a few minutes 2.2.0)

Few minutes didn't come. It happened in my Fedora 37 system where it showed this type of error. I even tried the Flatpak version but it did not show the same error message rather it showed some error message inside the QuickOSM Query search window. Finally, I had to delete my system and freshly install Ubuntu so that I could run the program without any problem.

mKIRArasif commented 1 year ago

Can be reproduced every time on Debian/testing.

  • install QGIS
  • install plugin via UI
  • try to open quickosm

et voila, breaking error

Where is the 2.2.0 for testing?

I had to clean my disk and freshly install Ubuntu just to run this freaking program.

elandorr commented 1 year ago

This should never be needed - try renaming the folders in ./config and ./local first. I couldn't imagine reinstalling my over many years carefully handcrafted system for a program!

However, I tried that, and it still won't work. This is some bigger issue. I'm not a regular QGIS user, this is in fact my first attempt. If it doesn't work here, it works nowhere.

mKIRArasif commented 1 year ago

This should never be needed - try renaming the folders in ./config and ./local first. I couldn't imagine reinstalling my over many years carefully handcrafted system for a program!

However, I tried that, and it still won't work. This is some bigger issue. I'm not a regular QGIS user, this is in fact my first attempt. If it doesn't work here, it works nowhere.

I solved my problem in a hard way or I should say that I escaped. This issue thread should come with a solution for the future sufferers.

elandorr commented 1 year ago

I tried on a completely new setup just out of curiosity. Still doesn't work. I considered Debian may be outdated, but the version in /testing is 3.22.

I don't even know, if QGIS is suited for my purpose. All I want are 100% offline maps :P. Sad state of the world when most everything is forced-online.

Let's see what the maintainers have to say about this.

Gustry commented 1 year ago

Where is the 2.2.0 for testing?

I got issues on the CI to upgrade from QGIS 3.16 to 3.22 QGIS minimum version. We can see the red ticks when I upgraded to QGIS 3.22 https://github.com/3liz/QuickOSM/commits/master I must fix that before make any new tag.

If I understand well, Fedora 37 and Debian testing are both coming with the latest version of Python 3.11, which was released last November 2022. Can you confirm, in the QGIS with the QuickOSM error, open your Python console (PluginsPython console), then

import sys
sys.version

I had to clean my disk and freshly install Ubuntu just to run this freaking program.

We all do our best some open source, free projects during our free time...

I don't even know, if QGIS is suited for my purpose. All I want are 100% offline maps :P. Sad state of the world when most everything is forced-online.

It's the purpose of QuickOSM. To query the OpenStreetMap database and fetch data locally within QGIS. You can still run OverpassTurbo to execute your query and export your GIS layers inside QGIS. https://overpass-turbo.eu/

mKIRArasif commented 1 year ago

Where is the 2.2.0 for testing?

I got issues on the CI to upgrade from QGIS 3.16 to 3.22 QGIS minimum version. We can see the red ticks when I upgraded to QGIS 3.22 https://github.com/3liz/QuickOSM/commits/master I must fix that before make any new tag.

If I understand well, Fedora 37 and Debian testing are both coming with the latest version of Python 3.11, which was released last November 2022. Can you confirm, in the QGIS with the QuickOSM error, open your Python console (PluginsPython console), then

import sys
sys.version

I had to clean my disk and freshly install Ubuntu just to run this freaking program.

We all do our best some open source, free projects during our free time...

I don't even know, if QGIS is suited for my purpose. All I want are 100% offline maps :P. Sad state of the world when most everything is forced-online.

It's the purpose of QuickOSM. To query the OpenStreetMap database and fetch data locally within QGIS. You can still run OverpassTurbo to execute your query and export your GIS layers inside QGIS. https://overpass-turbo.eu/

I appreciate every bit of work you all are putting on in the open source software verse. I always support the forum and grateful to you guys. But my problem needed an instant fix. I am sorry for that! The program worked on my LMDE system but refused to work on Fedora. I thought, the recent version of the softwares should not have problems. It was my lack of knowledge that created the frustration.

As for system information, I am sorry to say that I am not using Fedora right now.

dkv commented 1 year ago

Hi, I've got the same error, using QGIS 3.26.1-Buenos Aires and QuickOSM 2.1.1 on Fedora 37.

import sys
sys.version

gives: '3.11.1 (main, Jan 6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)]'

and doing this manually:

from definitions.format import Format
Format.GeoPackage.value

prints: ('GeoPackage', 'GPKG', 'gpkg')

Gustry commented 1 year ago

Ok, there is indeed a difference.

>>>import sys
>>>sys.version
'3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]'
>>>from QuickOSM.definitions.format import Format
>>>>Format.GeoPackage.value
format(label='GeoPackage', driver_name='GPKG', extension='gpkg')

Thanks for checking

elandorr commented 1 year ago

Can you confirm, in the QGIS with the QuickOSM error, open your Python console (PluginsPython console), then

Same here, it's the latest Py:

'3.11.1 (main, Dec 31 2022, 10:23:59) [GCC 12.2.0]'

It's the purpose of QuickOSM. To query the OpenStreetMap database and fetch data locally within QGIS. You can still run OverpassTurbo to execute your query and export your GIS layers inside QGIS. https://overpass-turbo.eu/

Thanks for sharing, I did not know that! I'm not a regular GIS user and find QGIS barely usable, but when you get that data, it's great, because it's OFFLINE.

I appreciate every bit of work you all are putting on in the open source software verse.

I can only reiterate this notion. Thanks for your efforts! I'm personally just frustrated by the utter lack of offline-anything, if I came across as rude. Somehow we have more computing power than ever, but virtually everything is forced online. The only tool in this space that really is usable without too much pain is google maps/earth pro. If you avoid Google, you're stuck with a niche you may need to research for several years, before you can proficiently solve the same problems you would in 5mins on there. QuickOSM seems like a vital part of the QGIS ecosystem. If I can figure out offline routing as well, that'd be great. Unfortunately QGIS UX is like it deliberately tries to keep you from using it. It's probably not intended to be used for routing and such 'regular' 'osmand' tasks.

Have a nice one

Gustry commented 1 year ago
>>>import sys
>>>sys.version
'3.11.2 (main, Feb 12 2023, 00:48:52) [GCC 12.2.0]'
>>>from QuickOSM.definitions.format import Format
>>>Format.GeoPackage.value
format(label='GeoPackage', driver_name='GPKG', extension='gpkg')

I got the same result as my previous result "Python 3.10.6".

Gustry commented 1 year ago

Same here, it's the latest Py: '3.11.1 (main, Dec 31 2022, 10:23:59) [GCC 12.2.0]'

The latest is version 3.11.2

I'm not sure, but it seems this closed ticket, affected in Python 3.11.1 : https://github.com/python/cpython/issues/100149 Did any of you can update to Python 3.11.2 ?

mKIRArasif commented 1 year ago

Two days ago, I installed Fedora 37 on Boxes and had run the Query plugin and it worked as expected. Can anyone check it?

Gustry commented 1 year ago

@mKIRArasif I guess this issue is resolved by upgrading your Python version.

I'm closing, please reopen if I'm wrong.

reportingsjr commented 1 year ago

Hello,

I can confirm that with python 3.11.1 this issue existed, and upgrading to 3.11.2 resolved it.

Thanks for the effort!

Gustry commented 1 year ago

Thanks for the feedback.

I'm surprised that a "small" plugin could be affected by a monthly regression from Python.