I have developed code to label points that pull formatting from a dictionary. I developed this code and it was working fine two weeks ago, today I try to open my map and I am now met with an error which I can't seem to trace in the code.
Before anyone marks my question as a duplicate, I have previously asked unrelated questions about this code
here: Using Python Dictionary to label subscript formatting ArcMap 10.6 [duplicate]
and here: Labeling using chemical formulas in subscripts that contain a mask in ArcMap 10.6
The error I am currently stuck on is:
"Error 0 on line 0
Traceback (most recent call last): File "< string >", line 1, in < module >
File "c:\programfiles(x86)\arcpy\arcpy_init.py", line 20, in < module >
import numpy
Import Error: No module named numpy
The code I am working with is:
def FindLabel ( [WellShape.GWMW_NAME], [2018ExceedanceFigureData-PEMLF_Mhuber.csv.SPRING_EXC], [2018ExceedanceFigureData-PEMLF_Mhuber.csv.FALL_EXC] ):
a = [2018ExceedanceFigureData-PEMLF_Mhuber.csv.SPRING_EXC]
b = [2018ExceedanceFigureData-PEMLF_Mhuber.csv.FALL_EXC]
formats = {
'SiO2': 'SiO<sub>2</sub>',
'CO32-': 'CO<sub>3</sub><sup>2-</sup>',
'HCO3-': 'HCO<sub>3</sub><sup>-</sup>',
'CaCO3': 'CaCO<sub>3</sub>',
'NH3': 'NH<sub>3</sub>',
'NO3-': 'NO<sub>3</sub><sup>-</sup>',
'NO2-': 'NO<sub>2</sub><sup>-</sup>',
'NO3-+NO2-': 'NO<sub>3</sub><sup>-</sup>+NO<sub>2</sub><sup>-</sup>',
'OH-': 'OH<sup>-</sup>',
'NO2-': 'NO<sub>2</sub><sup>-</sup>',
'Br-': 'Br<sup>-</sup>',
'SO42-': 'SO<sub>4</sub><sup>2-</sup>'
}
c = [str(i.strip(',')) for i in a[1:-1].split()]
d = [str(i.strip(',')) for i in b[1:-1].split()]
e = ','.join([formats.get(i,i) for i in c])
f = ','.join([formats.get(i,i) for i in d])
if a == "(-)" and b != "(-)":
return "{}\r\n <FNT scale='70'><CLR red='0' green='122' blue='192'>({})</CLR></FNT>".format( [WellShape.GWMW_NAME] ,f )
elif a != "(-)" and b == "(-)":
return "{}\r\n <FNT scale='70'><CLR red='255' green='0' blue='255'>({})</CLR></FNT>".format( [WellShape.GWMW_NAME] ,e )
elif a != "(-)" and b != "(-)":
return "{}\r\n <FNT scale='70'><CLR red='255' green='0' blue='255'>({})</CLR>\r\n<CLR red='0' green='122' blue='192'>({})</CLR></FNT>".format( [WellShape.GWMW_NAME] ,e ,f )
elif a == "(-)" and b == "(-)":
return [WellShape.GWMW_NAME]
Do you have any suggestions for finding/fixing this error?
I've already restarted my computer and application thinking the glitch may not be in the code (as it was working fine just a few weeks ago).
I am using ArcMap 10.6 and havent changed recently.
However my python updated on March 4th from 3.7.2 to 2.7.16... maybe this new version has an issue with numpy?