- changed status to resolved
error on opening raster file
Issue #921
resolved
Error occures when opening it in the EnMAP-Box. Use the attached file to reproduce.
An error has occurred while executing Python code:
AttributeError: 'NoneType' object has no attribute 'strip'
Traceback (most recent call last):
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\dataviews\dockmanager.py", line 544, in
dockArea.sigDropEvent.connect(lambda event: self.onDockAreaDragDropEvent(dockArea, event))
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\dataviews\dockmanager.py", line 580, in onDockAreaDragDropEvent
layers = extractMapLayers(mimeData)
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\mimedata.py", line 261, in extractMapLayers
dataSources = DataSourceFactory.create(url)
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\datasources\manager.py", line 817, in create
results.append(RasterDataSource(dataItem))
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\datasources\datasources.py", line 210, in __init__
self.updateNodes()
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\datasources\datasources.py", line 220, in updateNodes
self.mWavelength, self.mWavelengthUnits = parseWavelength(lyr)
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\externals\qps\utils.py", line 1905, in parseWavelength
bandWLU = checkWavelengthUnit(wluKey, band.GetMetadataItem(wluKey, wlDomain))
File "C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\externals\qps\utils.py", line 1796, in checkWavelengthUnit
value = value.strip()
AttributeError: 'NoneType' object has no attribute 'strip'
Python version: 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 15:37:01) [MSC v.1916 64 bit (AMD64)]
QGIS version: 3.18.3-Zürich Zürich, exported
Python Path:
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox\apps\ensomap
- d:/miniconda/envs/qgis/Library/./python
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
- d:/miniconda/envs/qgis/Library/./python/plugins
- d:\miniconda\envs\qgis\Library\python
- d:\miniconda\envs\qgis\Library\python\plugins
- C:\Users\Andreas
- d:\miniconda\envs\qgis\python37.zip
- d:\miniconda\envs\qgis\DLLs
- d:\miniconda\envs\qgis\lib
- d:\miniconda\envs\qgis\Library\bin
- C:\Users\Andreas\AppData\Roaming\Python\Python37\site-packages
- d:\miniconda\envs\qgis
- d:\miniconda\envs\qgis\lib\site-packages
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\BitFlagRenderer
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\BitFlagRenderer\bitflagrenderer
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\site-packages
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox\externals\qps\externals
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox\site-packages
- .
- C:/Users/Andreas/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\timeseriesviewerplugin
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\timeseriesviewerplugin\eotimeseriesviewer
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox\coreapps
- C:\Users\Andreas\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox\apps
Comments (4)
-
reporter -
reporter @Benjamin Jakimow your type annotations tends to lie
I would suggest to typeguard your functions and classes to assure type savety at runtime.
-
reporter This would give you a much better error message:
File "D:\source\QGISPlugIns\enmap-box\enmapbox\externals\qps\utils.py", line 1921, in parseWavelength bandWLU = checkWavelengthUnit(wluKey, band.GetMetadataItem(wluKey, wlDomain)) TypeError: type of argument "value" must be str; got NoneType instead
-
reporter Just use
@typechecked
as function decorator (from typeguard import typechecked)
- Log in to comment
resolves
#921→ <<cset 2d0fa19b2a54>>