UMEP-dev / UMEP

Urban Multi-scale Environmental Predictor
https://umep-docs.readthedocs.io/
62 stars 15 forks source link

SUEWS Prepare Python 3.9 QGIS3.20 #320

Closed gusbacos closed 3 years ago

gusbacos commented 3 years ago

Describe the bug SUEWS prepare does not start, but only produces Python Error.

`AttributeError: 'ElementTree' object has no attribute 'getiterator' Traceback (most recent call last): File "C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\UMEP.py", line 411, in SUEWS_Prepare sg = SUEWSPrepare(self.iface) File "C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSPrepare\suews_prepare.py", line 149, in init self.widget_list = [] File "C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSPrepare/Modules\xlrd__init__.py", line 130, in open_workbook bk = xlsx.open_workbook_2007_xml( File "C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSPrepare/Modules\xlrd\xlsx.py", line 812, in open_workbook_2007_xml x12book.process_stream(zflo, 'Workbook') File "C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSPrepare/Modules\xlrd\xlsx.py", line 266, in process_stream for elem in self.tree.iter() if Element_has_iter else self.tree.iter(): AttributeError: 'ElementTree' object has no attribute 'getiterator'

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.20.2-Odense Odense, 9f59a156

Python Path: C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSPrepare/Modules C:\Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_fusion C:/OSGeo4W/apps/qgis/./python C:/Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/OSGeo4W/apps/qgis/./python/plugins C:\Users\xbacos\AppData\Roaming\Python C:\OSGeo4W\bin\python39.zip C:\OSGeo4W\apps\Python39\DLLs C:\OSGeo4W\apps\Python39\lib C:\OSGeo4W\bin C:\Users\xbacos\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/xbacos/AppData/Roaming/QGIS/QGIS3\profiles\default/python . C:\OSGeo4W\apps\Python39\lib\site-packages\IPython\extensions`

To Reproduce Steps to reproduce the behavior:

  1. Click on SUEWS Prepare

Desktop (please complete the following information):

Additional context According to information on the xlrd project site (https://pypi.org/project/xlrd/) ,

"xlrd is a library for reading data and formatting information from Excel files in the historical .xls format.

Warning

This library will no longer read anything other than .xls files. For alternatives that read newer file formats, please see http://www.python-excel.org/. "

The files read in SUEWS-Prepare are in .xlsx and thus is not longer possible to read with xlrd. Instead other excel-readers such as openpyxl is suggested.

rarygit commented 3 years ago

Alternatively switch to python package odfpy and read in libreoffice worksheet, which uses open document format.

https://pypi.org/project/odfpy/ https://datascientyst.com/read-excel-opendocument-ods-python-pandas/ https://github.com/softhints/Pandas-Tutorials/blob/master/excel/2.read-excel-opendocument-ods-python-pandas.ipynb

biglimp commented 3 years ago

This is probably since versions changed from Python 3.7 to 3.9 in OSGeo. I think I have an solution soon...

biglimp commented 3 years ago

This was temporally fixed by switching to xls instead of xlsx files. Should maybe be fixed more thoroughly in the future.