Bug report #9300

NameError: global name 'exceptions' is not defined

Added by Weigang Wei almost 11 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:2.0.1 Regression?:No
Operating System:ubuntu Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17908

Description

An error has occured while executing Python code:

Traceback (most recent call last):
File "/usr/share/qgis/python/plugins/fTools/tools/doSpatialJoin.py", line 99, in accept
res = self.compute(inName, joinName, outPath, summary, sumList, keep, self.progressBar)
File "/usr/share/qgis/python/plugins/fTools/tools/doSpatialJoin.py", line 130, in compute
fieldList2 = ftools_utils.testForUniqueness(fieldList1, fieldList2)
File "/usr/share/qgis/python/plugins/fTools/tools/ftools_utils.py", line 162, in testForUniqueness
fieldList2[j] = createUniqueFieldName( fieldList2[j] )
File "/usr/share/qgis/python/plugins/fTools/tools/ftools_utils.py", line 178, in createUniqueFieldName
except exceptions.ValueError:
NameError: global name 'exceptions' is not defined

Python version:
2.7.3 (default, Sep 26 2013, 20:13:52)
[GCC 4.6.3]

QGIS version:
2.0.1-Dufour Dufour, exported

#################
Solution:
The code in file /usr/share/qgis/python/plugins/fTools/tools/ftools_utils.py does not define "exceptions".
The solution is:
replace the code in line 178 from "except exceptions.ValueError:" to "except:"

ftools_utils.py Magnifier - correction for the bug (14.3 KB) Weigang Wei, 2014-01-06 06:40 AM

Also available in: Atom PDF