2

I get an error when working Classification Erosion tool in Semi-automatic Classification Plugin (SCP). I use QGIS v3.2.2 and SCP v6.2.4.

The tool is not changing the pixels of the raster layer and creates this short report:

**An error has occurred while executing Python code:**
*NameError: name 'd' is not defined 
Traceback (most recent call last):
  File "C:/Users/Sergio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\erosionTab.py", line 65, in erosionClassificationAction
    self.erosionClassification()
  File "C:/Users/Sergio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\erosionTab.py", line 81, in erosionClassification
    sN = cfg.osSCP.path.basename(str(d))
NameError: name 'd' is not defined*

Classification before erosion:

Classification before erosion

3
  • What isn't working about it specifically?
    – AWGIS
    Commented Oct 1, 2018 at 15:37
  • Please see the text of the question now with additional comments.
    – Sergio
    Commented Oct 1, 2018 at 18:44
  • 3
    I'm voting to close this question as off-topic because this plugin is maintained by a specific person/team, this problem should be dealt by them and is outside the scope of this forum.
    – Hornbydd
    Commented Oct 1, 2018 at 22:10

1 Answer 1

3

Variable d doesn't exist and sN is not used anywhere within the file. So, changing that line into comment avoid you to get that error.

I'm not sure if it works but try these:

  1. Open erosionTab.py file in any editor. (C:/Users/Sergio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\erosionTab.py)
  2. Go to line 81 (sN=cfg.osSCP.path.basename(str(d)))
  3. Change to comment by adding hash # to beginning of the line. (#sN=cfg.osSCP.path.basename(str(d)))
  4. Save the file, re-open QGIS and try to run SCP again.
1
  • Reported as a bug on GitHub Commented Oct 2, 2018 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.