7

While using QGIS 3.10 and 3.16 on Mac OS X Big Sur, the Bivariate legend plugin throws a NameError exception. How do I fix this or work around it?

The following stack trace is from QGIS 3.10. The 3.16 stack trace seems similar.

An error has occurred while executing Python code:

NameError: name 'Qgis' is not defined 
Traceback (most recent call last):
  File "/Users/judithheher/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/BivariateLegend/bivariate_legend.py", line 400, in generate_image
    level=Qgis.Info
NameError: name 'Qgis' is not defined

Versions:
Python version: 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]
QGIS version: 3.10.11-A Coruña A Coruña, d2171173e4

Python Path:

/Applications/QGIS3.10.app/Contents/MacOS/../Resources/python
/Users/judithheher/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/judithheher/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS3.10.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS3.10.app/Contents/Resources/python
/Applications/QGIS3.10.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/site-packages
/Applications/QGIS3.10.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7
/Applications/QGIS3.10.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python37.zip
/Applications/QGIS3.10.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/lib-dynload
/Applications/QGIS3.10.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/site-packages/geos
/Users/judithheher/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/judithheher/Documents/Home/SJSU/GEOG171/Week4
10

The file bivariate_legend.py has a missing import.

  • Open file /Users/judithheher/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/BivariateLegend/bivariate_legend.py in any editor.
  • Add from qgis.core import Qgis to the import section.
  • Restart QGIS and retry. The plugin will run seamlessly.
3
  • 2
    Made the fix in the original plugin (I'm the maintainer). Waiting for plugin approval. Thanks for the feedback on the tracker @Kadir Şahbaz
    – ThomasG77
    Feb 22 at 23:54
  • This worked like a charm! BTW I tried to find a way to contact you, ThomasG77, but couldn't the QGIS site kept me going in circles.
    – JHeher
    Feb 23 at 23:58
  • If any other issues with my plugin or someone else, go to plugins.qgis.org, search the plugin, click on it and then, in the tabs, click on "Details" and find the "Code repository" to be redirected to the code repository. In my case, github.com/webgeodatavore/bivariate_legend. Then, you can go to "issues" tab and create a "New issue". You need a Github account to to this but for some other repositories, it could be bitbucket, gitlab or dedicated hosting for git repository
    – ThomasG77
    Feb 24 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.