Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87387

Odd ValueError using float

From emile <emile@fenx.com>
Subject Odd ValueError using float
Date 2015-03-13 15:10 -0700
Newsgroups comp.lang.python
Message-ID <mailman.336.1426284641.21433.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Odd ValueError using float emile <emile@fenx.com> - 2015-03-13 15:10 -0700
  Re: Odd ValueError using float Paul Rubin <no.email@nospam.invalid> - 2015-03-13 19:33 -0700
    Re: Odd ValueError using float Chris Angelico <rosuav@gmail.com> - 2015-03-14 14:09 +1100
    Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 08:28 -0700
    Re: Odd ValueError using float Chris Angelico <rosuav@gmail.com> - 2015-03-15 02:52 +1100
    Re: Odd ValueError using float Peter Otten <__peter__@web.de> - 2015-03-14 17:08 +0100
    Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 10:08 -0700
    Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 10:17 -0700
    Re: Odd ValueError using float Peter Otten <__peter__@web.de> - 2015-03-14 19:24 +0100
    Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 13:01 -0700
    Re: Odd ValueError using float Peter Otten <__peter__@web.de> - 2015-03-15 15:01 +0100
    Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-17 13:48 -0700

csiph-web