1

I am trying to edit a model I built in the QGis graphical modeler and I get the following error.

IndentationError: unindent does not match any outer indentation level

2017-11-27T14:53:42 1   Traceback (most recent call last):
              File "C:/PROGRA~1/QGIS2~1.14/apps/qgis-ltr/./python/plugins\processing\modeler\EditModelAction.py", line 42, in execute
                dlg = ModelerDialog(self.alg.getCopy())
              File "C:/PROGRA~1/QGIS2~1.14/apps/qgis-ltr/./python/plugins\processing\modeler\ModelerDialog.py", line 190, in __init__
                self.repaintModel()
              File "C:/PROGRA~1/QGIS2~1.14/apps/qgis-ltr/./python/plugins\processing\modeler\ModelerDialog.py", line 374, in repaintModel
                self.scene.paintModel(self.alg)
              File "C:/PROGRA~1/QGIS2~1.14/apps/qgis-ltr/./python/plugins\processing\modeler\ModelerScene.py", line 115, in paintModel
                arrow = ModelerArrowItem(self.algItems[depend], -1,
            KeyError: u'SCRIPTADDFEATUREWITHOUTGEOMETRY_1'

I added this script to work around an extract by location error and when i tried to remove it Qgis closed the modeler and threw a warning. Now I only get this error when trying to edit. It's a pretty complicated model with 19 processes and I'd hate to have to go back and rebuild it. Is there a way to fix this?

  • 1
    When you say "I added a this script to work around an extract by location error" do you mean that you modified a script? If so, then it sounds like you need to check the indentation of the code that you modified. – PolyGeo Nov 27 '17 at 23:07
  • 1
    I can see the error but where is the code? Around line 115 of paintModel. It looks like you haven't finished the argument arrow = ModelerArrowItem(self.algItems[depend], -1,, where's the last parameter and closing bracket? The next thing to look at is spaces or tabs, neither matter as long as you're consistent, if the original has one TAB but your edit has ~4 spaces (or the other way around) that is an inconsistent indent. A good editor like Notepad++ can show the tabs or spaces stackoverflow.com/questions/39258979/… – Michael Stimson Nov 27 '17 at 23:11
  • 2
    For questions that involve code we ask that you show us where you are stuck with your own code by including a code snippet in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely. It sounds like the code you are linking to is what the code looked like before you modified it. – PolyGeo Nov 27 '17 at 23:18
  • 2
    Not really, I can't see any code. We really need to see your code as modified to offer any kind of guidance. Please copy/paste into your question about a dozen lines around line 115 of paintModel. Don't forget to hit the {} for formatting code. – Michael Stimson Nov 27 '17 at 23:18
  • 1
    @brink - Before you remove the script, you need to make sure any algorithms which use the script as an input is changed. For example, in the post you linked in your question, the screenshot of the model in the answer has a script which is used as an input to the Extract by location tool. This tool needs to be edited and have the input parameter changed so that it doesn't connect to the script. When this is done, the script can be removed safely. – Joseph Nov 28 '17 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.