teksi / wastewater

[DEV] Future TEKSI wastewater module, adapted data model to fit VSA-DSS 2020 new standard
https://teksi.github.io/wastewater
GNU General Public License v3.0
0 stars 4 forks source link

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 12: character maps to Traceback #229

Open sjib opened 1 month ago

sjib commented 1 month ago

Ein Fehler trat bei der Ausführung von Python-Code auf:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 12: character maps to Traceback (most recent call last): File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksiwastewater\interlis\utils\various.py", line 59, in exec proc = subprocess.run( File "C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command ''C:\Program Files\Eclipse Foundation\jre-11.0.12.7-hotspot\bin\java' -jar 'C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\bin\ilivalidator-1.11.9\ilivalidator-1.11.9.jar' --log 'C:\Users\Stefan\AppData\Local\Temp\tww2ili\240502153155.ilivalidator.log' 'C:/Daten/QGEP/testing162/dssexport_2024-04-26mod_convert2020_output/dss2020_1/vsa_organisationen_2020_1_20240418.xtf'' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\teksi_wastewater_plugin.py", line 491, in actionImportClicked self.interlisImporterExporter.action_import() File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 79, in action_import raise exception File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 60, in action_import self.interlis_importer_exporter.interlis_import( File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 78, in interlis_import self._import_validate_xtf_file(xtf_file_input) File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 209, in _import_validate_xtf_file self.interlisTools.validate_xtf_data( File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\utils\ili2db.py", line 78, in validate_xtfdata exec( File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksiwastewater\interlis\utils\various.py", line 68, in exec logger.exception(e.output.decode("windows-1252" if os.name == "nt" else "utf-8")) File "C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\encodings\cp1252.py", line 15, in decode return codecs.charmap_decode(input,errors,decoding_table) UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 12: character maps to

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.28.4-Firenze Firenze, fd0fb72ab3

Python-Pfad: C:/PROGRA~1/QGIS 3.28.4/apps/qgis-ltr/./python C:/Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python C:/Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins C:/PROGRA~1/QGIS 3.28.4/apps/qgis-ltr/./python/plugins C:\Program Files\QGIS 3.28.4\bin\python39.zip C:\PROGRA~1\QGIS 3.28.4\apps\Python39\DLLs C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib C:\Program Files\QGIS 3.28.4\bin C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages C:\PROGRA~1\QGIS 3.28.4\apps\Python39 C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages\win32 C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages\win32\lib C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages\Pythonwin C:/Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python C:/Daten/QGEP/testing_dss2020/20240429/teksi_wastewater2024-04-28 C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\gui.... C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\gui....

sjib commented 1 month ago

@domi4484 Any idea why this happens?

domi4484 commented 1 month ago

In first place it seems that ilivalidate detected an error in the ili file. You should find out why in the ili log file.

Second, the plugin could not correctly handle the error message as it contains some special characters it could not handle.

I guess to fix it we would need the output of this command if you run it in a cmd.exe of powershell:

'C:\Program Files\Eclipse Foundation\jre-11.0.12.7-hotspot\bin\java' -jar 'C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\bin\ilivalidator-1.11.9\ilivalidator-1.11.9.jar' --log 'C:\Users\Stefan\AppData\Local\Temp\tww2ili\240502153155.ilivalidator.log' 'C:/Daten/QGEP/testing162/dssexport_2024-04-26mod_convert2020_output/dss2020_1/vsa_organisationen_2020_1_20240418.xtf''
sjib commented 1 month ago

I checked the file that I downloaded from here: https://www.vsa.ch/models/organisation/vsa_organisationen_2020_1.xtf It gives no errors in ilivalidator. I checked with other xtf files and always get that same error. So I do not think it's a problem of the xtf. I also checked the xml syntax separately in notepad++

If I test in cmd.exe I get the following error: C:\Users\Stefan>'C:\Program Files\Eclipse Foundation\jre-11.0.12.7-hotspot\bin\java' -jar 'C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_testing2/python/plugins\teksi_wastewater\interlis\bin\ilivalidator-1.11.9\ilivalidator-1.11.9.jar' --log 'C:\Users\Stefan\AppData\Local\Temp\tww2ili\240502153155.ilivalidator.log' 'C:/Daten/QGEP/testing162/dssexport_2024-04-26mod_convert2020_output/dss2020_1/vsa_organisationen_2020_1_20240418.xtf'' Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.

@domi4484 could this be a problem of the different / and \ in the file pathes? I tested with replacing all / with \ and vice versa - C:\ has to be like that.

C:\Users\Stefan>'C:\Program Files\Eclipse Foundation\jre-11.0.12.7-hotspot\bin\java' -jar 'C:\Users\Stefan\AppData\Roaming\QGIS\QGIS3\profiles\tww_testing2\python\plugins\teksi_wastewater\interlis\bin\ilivalidator-1.11.9\ilivalidator-1.11.9.jar' --log 'C:\Users\Stefan\AppData\Local\Temp\tww2ili\240502153155.ilivalidator.log' 'C:\Daten\QGEP\testing162\dssexport_2024-04-26mod_convert2020_output\dss2020_1\vsa_organisationen_2020_1_20240418.xtf' Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.

sjib commented 1 month ago

I have used this plugin version: https://github.com/teksi/wastewater/releases/download/2024.0.rc1/teksi_wastewater.0.0.0.zip Do I need to use another one? Have there been changes inbetween?

domi4484 commented 1 month ago

Effectively now I notice there are single quotes in the command. It is quite sure same bug as #220 closed in #221

sjib commented 1 month ago

to do re-check if working when a new (pre-)release is availabel

domi4484 commented 1 month ago

@sjib at this page you can download the currently latest plugin version.

ponceta commented 2 weeks ago

To test @ponceta @sjib