Odd ValueError using float

emile emile at fenx.com
Fri Mar 13 18:10:15 EDT 2015


On an older WinXP SP2 box with python2.6 that's been running this 
process fine for years, this week we're seeing:

 > c:\python26\lib\site-packages\fenx\sql_interface.py(144)normalized()
-> return val
(Pdb) val
*** NameError: name 'val' is not defined
(Pdb) l
139         try:
140             val = round(float(decval),1)
141         except:
142             import pdb; pdb.set_trace()
143         #val = round(float(int(decval)/10**((decval%100)*100)),1)
144  ->     return val
145
146
147     def foodList(reference):
148         # return a list of (code,val) tuples for the ingredients of 
the foodlist referenced
149         # local internal use only to create sqlFoodListsByID
(Pdb) decval
'4'
(Pdb) len(decval)
1
(Pdb) int(decval)
*** ValueError: invalid literal for int() with base 10: '41.700000000000003'
(Pdb)


Any ideas?

Thanks,

Emile




More information about the Python-list mailing list