Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibilidad con 3.40.0 #10

Open
pablohevia opened this issue Nov 8, 2024 · 0 comments
Open

Incompatibilidad con 3.40.0 #10

pablohevia opened this issue Nov 8, 2024 · 0 comments

Comments

@pablohevia
Copy link

Hola @fpsampayo

En QGIS 3.40.0, al abrir, da este error:

2024-11-08T12:09:41 CRITICAL Traceback (most recent call last):
File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 426, in startPlugin
plugins[packageName] = package.classFactory(iface)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/Pablo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\zoomrc_init
.py", line 35, in classFactory
from .zoomrc import ZoomRC
File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 966, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/Pablo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\zoomrc\zoomrc.py", line 29, in
from .gui.zoomrc_dockwidget import ZoomRCDockWidget
File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 966, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/Pablo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\zoomrc\gui\zoomrc_dockwidget.py", line 32, in
from zoomrc.core.catastroTools import CatastroTools
File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 966, in _import
mod = builtin_import(name, globals, locals, fromlist, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/Pablo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\zoomrc\core\catastroTools.py", line 27, in
from qgis.gui import QgsRubberBand, Qgis
ImportError: cannot import name 'Qgis' from 'qgis.gui' (C:\OSGeo4W/apps/qgis/./python\qgis\gui_init
.py). Did you mean: 'qgis'?

Quizá haya una solución más limpia, pero lo he resuelto con la ayuda de ChatGPT, editando catastroTools.py y he dejado así los import del principio:

from urllib import request, parse
from xml.dom import minidom
from qgis.core import QgsVectorLayer, QgsRectangle, QgsProject
from qgis.gui import QgsRubberBand
from PyQt5.QtGui import QColor

# Importación condicional de Qgis para compatibilidad con varias versiones
try:
    from qgis.core import Qgis  # Intentar importar desde qgis.core (para versiones más nuevas)
except ImportError:
    from qgis.gui import Qgis  # En caso de error, importar desde qgis.gui (para versiones anteriores)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant