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


Groups > comp.lang.python > #87387

Odd ValueError using float

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'except:': 0.09; 'literal': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'referenced': 0.09; 'subject:using': 0.09; 'try:': 0.09; 'val': 0.09; 'valueerror:': 0.09; 'def': 0.12; '(pdb)': 0.16; 'nameerror:': 0.16; 'pdb;': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'thanks,': 0.17; 'import': 0.22; 'header:User-Agent:1': 0.23; 'fine': 0.24; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'tuples': 0.31; "we're": 0.32; 'running': 0.33; 'older': 0.33; 'list': 0.37; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'name': 0.63; 'invalid': 0.68; '10:': 0.84; '144': 0.84; '145': 0.84; 'received:pacbell.net': 0.84; '***': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From emile <emile@fenx.com>
Subject Odd ValueError using float
Date Fri, 13 Mar 2015 15:10:15 -0700
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-69-226-129-65.dsl.pltn13.pacbell.net
User-Agent Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.19
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.336.1426284641.21433.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1426284641 news.xs4all.nl 2867 [2001:888:2000:d::a6]:54687
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:87387

Show key headers only | 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