[rasterlayerstylingpanel] Opening/activating while WMS is openend causes python error

Issue #1236 resolved
Fabian Thiel created an issue

When a WMS is opened while opening the rasterlayerstylingpanelcauses the following error:

An error has occurred while executing Python code: 

RuntimeError: type=xyz&url=https://mt1.google.com/vt/lyrs%3Ds%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=19&zmin=0: No such file or directory 
Traceback (most recent call last):
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/coreapps/rasterlayerstylingapp/rasterlayerstylingpanel.py", line 220, in onPanelVisibilityChanged
    self.onLayerChanged()  # trigger GUI initialization
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/coreapps/rasterlayerstylingapp/rasterlayerstylingpanel.py", line 264, in onLayerChanged
    self.updateGui()
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/coreapps/rasterlayerstylingapp/rasterlayerstylingpanel.py", line 185, in updateGui
    bandNo = CreateSpectralIndicesAlgorithm.findBroadBand(layer, sname, strict=True)
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/typeguard/__init__.py", line 903, in wrapper
    retval = func(*args, **kwargs)
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/algorithm/createspectralindicesalgorithm.py", line 258, in findBroadBand
    reader = RasterReader(raster)
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/typeguard/__init__.py", line 903, in wrapper
    retval = func(*args, **kwargs)
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/rasterreader.py", line 46, in __init__
    gdalDataset: gdal.Dataset = gdal.Open(self.provider.dataSourceUri(), gdal.GA_ReadOnly)
  File "/usr/lib/python3/dist-packages/osgeo/gdal.py", line 2978, in Open
    return _gdal.Open(*args)
RuntimeError: type=xyz&url=https://mt1.google.com/vt/lyrs%3Ds%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=19&zmin=0: No such file or directory

#QGIS version
3.24.1-Tisler
#QGIS code revision
5709b82461
#Qt version
5.12.8
#Python version
3.8.10
#GDAL/OGR version
3.0.4
#PROJ version
6.3.1
#EPSG Registry database version
v9.8.6 (2020-01-22)
#Compiled against GEOS
3.8.0-CAPI-1.13.1
#Running against GEOS
3.8.0-CAPI-1.13.1 
#OS version
Ubuntu 20.04.4 LTS