UMEP icon indicating copy to clipboard operation
UMEP copied to clipboard

An error has occurred while executing Python code - GQF

Open biglimp opened this issue 2 years ago • 2 comments

Discussed in https://github.com/UMEP-dev/UMEP/discussions/565

Originally posted by 030Skript October 30, 2023 Hello all,

I wanted to use the GQF module for my master thesis. While trying to start the tutorial, I encountered the following problem on 2 different computers (Windows 10). After installing UMEP (4.0.2) for QGIS (3.34) and downloading the following packages, I prepared the data sources and clicked on "Prepare input data via data sources" and after a few seconds I got:

An error has occurred while executing Python code

IndexError: list index out of range 
Traceback (most recent call last):
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\greater_qf.py", line 192, in disaggregate
    processed = self.model.processInputData()
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\PythonQF2\GreaterQF.py", line 105, in processInputData
    processedPath = disaggregate(
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\PythonQF2\Disaggregate.py", line 72, in disaggregate
    bldgEnergy.setIndustrialElec(ie['shapefile'],
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\PythonQF2\EnergyUseData.py", line 76, in setIndustrialElec
    return self.indElec.addInput(input, startTime, attributeToUse, inputFieldId, weight_by=weight_by, epsgCode=epsgCode)
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\PythonQF2\DataManagement\SpatialTemporalResampler.py", line 448, in addInput
    return self.dealWithVectorLayer(input, epsgCode, startTime, attributeToUse, weight_by, inputFieldId)
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\PythonQF2\DataManagement\SpatialTemporalResampler.py", line 168, in dealWithVectorLayer
    resampled = self.resampleLayer(vectorLayer, attributeToUse, weight_by, inputIdField)
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\PythonQF2\DataManagement\SpatialTemporalResampler.py", line 325, in resampleLayer
    if sameFeatures(inputLayer, self.outputLayer):
  File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\GreaterQF\PythonQF2\DataManagement\spatialHelpers.py", line 913, in sameFeatures
    infeat = layer1.selectedFeatures()[0]
IndexError: list index out of range

version info:

Python-Version: 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] 
QGIS-Version: 3.34.0-Prizren Prizren, ffbdd67881 

Python-Pfad:
C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSPrepare/Modules
C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep
C:/OSGeo4W/apps/qgis/./python
C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/OSGeo4W/apps/qgis/./python/plugins
C:\OSGeo4W\apps\grass\grass83\etc\python
C:\Users\User\Documents
C:\OSGeo4W\bin\python39.zip
C:\OSGeo4W\apps\Python39\DLLs
C:\OSGeo4W\apps\Python39\lib
C:\OSGeo4W\bin
C:\Users\User\AppData\Roaming\Python\Python39\site-packages
C:\OSGeo4W\apps\Python39
C:\OSGeo4W\apps\Python39\lib\site-packages
C:\OSGeo4W\apps\Python39\lib\site-packages\win32
C:\OSGeo4W\apps\Python39\lib\site-packages\win32\lib
C:\OSGeo4W\apps\Python39\lib\site-packages\Pythonwin
C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python

So, now that I've tried it on my PC and have the same problem, I hope you guys have a solution to this issue? After pressing the button once, I can no longer use it and have to restart QGIS.

biglimp avatar Oct 30 '23 14:10 biglimp

Hi, I transferred this to the issue section as this most likely is a bug. The last known time the GQF tool was working was QGIS version 3.2. Since then, QGIS has been updated multiple times and this is probably the reason of your issue. Since we do not have any one person working with GQF within our development team, I am not sure we can help you to fix this issue in the near future.

biglimp avatar Oct 30 '23 14:10 biglimp

Hey, thanks for the reply. That's pretty unfortunate for me. Does no one else have any suggestions?

030Skript avatar Nov 08 '23 08:11 030Skript