A couple of things here.  (1) try:... except:... should only be used for for truly exceptional cases.  Here everything is under control.   Here is how I would write this block:

```python
nucvecvals = nucvec.values()
isatom = 0 <= nucvecvals[0]
for value in nucvecvals[1:]:
    if 0 != isatom - (0 <= value):
         msg = 'Mixed atom and mass fractions not supported.  See material defined on line {0}'.format(mat_line)
        raise ValueError(msg)
```