Bug report #11335

NameError with Processing - global name self is not defined

Added by Pedro Venâncio over 9 years ago. Updated over 9 years ago.

Assignee:Victor Olaya
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:19629


After update to QGIS 2.5.0-92 (OSGeo4W) I get this error:

Couldn't load plugin processing due an error when calling its initGui() method

Traceback (most recent call last):
  File "C:/OSGEO4~1/apps/qgis-dev/./python\\qgis\\utils.py", line 217, in startPlugin
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\ProcessingPlugin.py", line 54, in initGui
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\core\\Processing.py", line 153, in initialize
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\core\\Processing.py", line 166, in loadFromProviders
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\core\\Processing.py", line 210, in loadAlgorithms
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\core\\AlgorithmProvider.py", line 57, in loadAlgorithms
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\modeler\\ModelerAlgorithmProvider.py", line 74, in _loadAlgorithms
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\modeler\\ModelerAlgorithmProvider.py", line 84, in loadFromFolder
    alg = ModelerAlgorithm.fromFile(fullpath)
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\modeler\\ModelerAlgorithm.py", line 541, in fromFile
    alg = ModelerAlgorithm.fromOldFormatFile(filename)
  File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\\processing\\modeler\\ModelerAlgorithm.py", line 637, in fromOldFormatFile
    raise WrongModelException(self.tr('Error in model definition line: %s\
%s', 'ModelerAlgorithm') % (line.strip(), traceback.format_exc()))
NameError: global name 'self' is not defined

It seems something related with the backward compatibility of models.

1_1_preparacao.model (4.61 KB) Pedro Venâncio, 2014-10-06 02:11 AM

1_preparacao.model (20 KB) Pedro Venâncio, 2014-10-06 02:11 AM


#1 Updated by Victor Olaya over 9 years ago

  • Status changed from Open to Feedback

There are two problems in here. One, the model is not being loaded, so the backwards compatibility is not perfect. Two, there is an error in the internationalization code that Alex added during the HF. I will work on the first one. Coudl you attach the model that is causing this problem? Thanks!

#2 Updated by Pedro Venâncio over 9 years ago

Hi Victor,

I attach two models:

- with 1_1_preparacao.model, I get no error;

- with 1_preparacao.model, I get the error described.

#3 Updated by Victor Olaya over 9 years ago

The error with int i18n is fixed. The error of not being able to load your model is actually not a modeler error. The syntax of the raster calculator has changed, so all old models using it will break.

I will try to manually edit you model and send a corrected one back to you, since it is a very big model and i guess you do not want to create it again :-)

#4 Updated by Pedro Venâncio over 9 years ago

Hi Victor,

No, it is not necessary, I take care of it! Don't worry! These are not yet final models!

Thank you so much!

Best regards!

#5 Updated by Paolo Cavallini over 9 years ago

Seems fixed here.

#6 Updated by Pedro Venâncio over 9 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF