Odd ValueError using float

Paul Rubin no.email at nospam.invalid
Fri Mar 13 22:33:20 EDT 2015


emile <emile at fenx.com> writes:
> *** NameError: name 'val' is not defined
> (Pdb) l
> 139         try:
> 140             val = round(float(decval),1)
> 141         except:
> 142             import pdb; pdb.set_trace()

If 'float' or 'round' throw an exception, the assignment to 'val' never
happens, so 'val' is undefined.  Try examining the value of 'decval' in
the debugger to see what is making the conversion fail.



More information about the Python-list mailing list