MarcoDuiker/QGIS_BGT_Import

Couldn't load plugin 'BGTImport' due to an error when calling its classFactory() method

Closed this issue · 5 comments

RSOS1 commented

Couldn't load plugin 'BGTImport' due to an error when calling its classFactory() method

ModuleNotFoundError: No module named 'ogr'
Traceback (most recent call last):
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 334, in _startPlugin
plugins[packageName] = package.classFactory(iface)
File "/Users/stagiairels1/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/BGTImport/init.py", line 34, in classFactory
from .bgt_import import BGTImport
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Users/stagiairels1/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/BGTImport/bgt_import.py", line 50, in
import ogr
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 792, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'ogr'

You are using the latest and greatest QGIS an gdal libs.

import ogr 

was deprecated, but now is wrong. It should be:

from osgeo import ogr

I'll create a fix. Up to that moment you can do a quick fix as suggested here.

RSOS1 commented

Okay, thank you very much. Can you please let me know once the fix is done?

I've submitted an update (3.16) to the plugin repo.
As soon it is approved you can install the new version.

reopend till the update is accepted

The new update 3.16 is accepted. The issue should be a thing of the past.