Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: cannot access local variable 'vertex' where it is not associated with a value #456

Open
sjib opened this issue Oct 12, 2024 · 3 comments · May be fixed by #457
Open

UnboundLocalError: cannot access local variable 'vertex' where it is not associated with a value #456

sjib opened this issue Oct 12, 2024 · 3 comments · May be fixed by #457
Labels
bug Something isn't working

Comments

@sjib
Copy link
Contributor

sjib commented Oct 12, 2024

Describe the bug
A clear and concise description of what the bug is.

Run refresh network topology (on opening project or manually)

To Reproduce
Exact steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots / data
If applicable, add screenshots or data to help explain your problem.

2024-10-12T20:21:10     CRITICAL    Error : Status 7 (FEHLER: storniere Anfrage wegen Zeitüberschreitung der Anfrage
             CONTEXT: SQL-Anweisung »REFRESH MATERIALIZED VIEW tww_app.vw_network_node«
             PL/pgSQL-Funktion tww_app.network_refresh_network_simple() Zeile 106 bei SQL-Anweisung
             )
2024-10-12T20:21:10     WARNING    Python-Fehler : Ein Fehler trat bei der Ausführung von Python-Code auf: Mehr Details im Protokoll (Python-Fehler).
2024-10-12T20:16:21     WARNING    Traceback (most recent call last):
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_2024.0.2/python/plugins\teksi_wastewater\teksi_wastewater_plugin.py", line 446, in onLayersAvailable
              self.network_analyzer.setNodeLayer(layers["vw_network_node"])
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_2024.0.2/python/plugins\teksi_wastewater\tools\twwnetwork.py", line 94, in setNodeLayer
              self.createGraph()
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_2024.0.2/python/plugins\teksi_wastewater\tools\twwnetwork.py", line 219, in createGraph
              self._addVertices()
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_2024.0.2/python/plugins\teksi_wastewater\tools\twwnetwork.py", line 116, in _addVertices
              self.graph.add_node(fid, point=vertex, objType=obj_type, objId=obj_id)
              ^^^^^^
             UnboundLocalError: cannot access local variable 'vertex' where it is not associated with a value

Desktop (please complete the following information):

  • TWW version 2024.0.2
  • QGIS Version 3.34.8
  • OS Windows 10

Additional context
Add any other context about the problem here.

Very big dataset - do we have a timeout somewhere in the code?

@sjib sjib added the bug Something isn't working label Oct 12, 2024
@cymed
Copy link
Contributor

cymed commented Oct 14, 2024

I think vertex was not populated because of a ValueError the the Try-Catch in

try:
vertex = feat.geometry().asPoint()
except ValueError:
# TODO Add to problem log
pass
self.graph.add_node(fid, point=vertex, objType=obj_type, objId=obj_id)

Are there wastewater nodes without geometry?

@sjib
Copy link
Contributor Author

sjib commented Oct 14, 2024

Then we should think about how to handle this and create a more meaningful error message.

@sjib
Copy link
Contributor Author

sjib commented Oct 14, 2024

And / or discuss whether 'Lage' should be MANDATORY in INTERLIS in the future?

!!@ comment = "Lage des Knotens, massgebender Bezugspunkt für die Kanalnetzberechnung. (In der Regel Lage des Pickellochs oder Lage des Trockenwetterauslaufs)" Lage: Base_LV95.LKoord; !!@ comment = "1. Massgebende Rückstaukote bezogen auf den Berechnungsregen (dss) 2. Höhe, unter der innerhalb der Grundstücksentwässerung besondere Massnahmen gegen Rückstau zu treffen sind. (DIN 4045)" Rueckstaukote_Ist: Base_LV95.Hoehe; !!@ comment = "Tiefster Punkt des Knotens. Bei Sonderbauwerken tiefster Punkt des Knotens zu dem die Stammkarte gehört, also in der Regel Auslauf Richtung ARA." Sohlenkote: Base_LV95.Hoehe; END Abwasserknoten;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants