Riverscapes / QRAVEPlugin

QGIS Plugin for viewing Riverscapes projects
0 stars 0 forks source link

Error opening project for NEW project type without BLogic in RiverscapesXML #96

Closed jtgilbert closed 2 months ago

jtgilbert commented 7 months ago

Trying to open this project, although none are working.

Traceback (most recent call last):
  File "C:\Users/jordang/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qrave_toolbar\src\qrave_toolbar.py", line 346, in projectBrowserDlg
    self.dockwidget.add_project(dialog_return[0])
  File "C:\Users/jordang/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qrave_toolbar\src\dock_widget.py", line 234, in add_project
    basename = test_project.qproject.text()
AttributeError: 'NoneType' object has no attribute 'text'

Worth noting, in the existing business logic file,
xsi:noNamespaceSchemaLocation="http://xml.riverscapes.net/RaveBusinessLogic/XSD/project_explorer.xsd" incorrectly has the old .xyz address, but that is not the issue as fixing it doesn't resolve the problem.


UPDATE

This is actually a more serious issue or set of issues.

  1. We need better handling when the project type doesn't match anything we have business logic for. These "NoneType" has no attribute "text" errors should be weeded out as they are not at all helpful.
  2. There is also a case where there IS a legitimate business logic file locally for a new project type (RME in this case) but this is STILL failing because there is nothing in RiverscapesXML
jtgilbert commented 7 months ago

@MattReimer even with the BL present in RSXML I'm still getting this error opening projects

MattReimer commented 2 months ago

This is part of a family of bugs (related but not duplicates) that will all be closed together

MattReimer commented 2 months ago

Ok, to your points: (any fixes I mention will be in 0.9.2 btw)

Problem 0

There were a bunch of issues where an object wasn't being checked for assignment and that resulted in many/all the "NoneType" object has no attribute 'text'. Not promissing this fix will catch all of those problems but they should be greatly reduced and we can open new issues for any that we didn't catch.

Problem 1

  1. We need better handling when the project type doesn't match anything we have business logic for. These "NoneType" has no attribute "text" errors should be weeded out as they are not at all helpful.

100% AGREE! I've improved the errors slightly so that when a project can't load due to NO business logic you now get:

2024-04-25T10:27:39     CRITICAL    Exception Could not find a valid business logic file. Valid paths are: 
             [
              "/Users/matt/Downloads/Metric_Engine-Metric_Engine_for_Lower_Stillwater_River (1)/rs_metric_engine1.xml",
              "/Users/matt/Work/Git/Riverscapes/QRAVEPlugin/resources/blXML/V2/rs_metric_engine1.xml",
              "/Users/matt/Work/Git/Riverscapes/QRAVEPlugin/resources/blXML/default.xml"
             ]

which is a lot more clear I think.

Problem 1A

Also it couldn't find the default.xml because it was in the V2 folder. I've fixed that so that projects without businesslogic files now load (even if it's just a dummy default load)

Problem 2

  1. There is also a case where there IS a legitimate business logic file locally for a new project type (RME in this case) but this is STILL failing because there is nothing in RiverscapesXML

This is now fixed. IF there is a new project type that is. not in XML (rs_metric_engine1 in this case) and IF there is an appropriately-named businesslogic file (again, rs_metric_engine1.xml in this case) next to the project.rs.xml file. then it will load normally, even if it is not in RiverscapesXML

Expect these changes in 0.9.2