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


Groups > comp.lang.python > #87452

Re: Odd ValueError using float

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'suddenly': 0.07; 'string': 0.09; 'here?': 0.09; 'literal': 0.09; 'mess': 0.09; 'subject:using': 0.09; 'valueerror:': 0.09; 'cc:addr:python-list': 0.11; '(pdb)': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'simpson': 0.16; 'stuff,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'module': 0.19; 'cc:addr:python.org': 0.22; 'error': 0.23; 'looks': 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'extension': 0.26; 'possibly': 0.26; 'somewhere': 0.26; 'van': 0.27; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'character': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'maybe': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'generating': 0.39; 'mar': 0.68; 'invalid': 0.68; 'containing': 0.69; 'obvious': 0.74; 'completion': 0.78; '10:': 0.84; '2015': 0.84; 'to:none': 0.92; 'have.': 0.93; '***': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=blA8Azzc8FTCyv9rrx7fh/d0Vinadb5m6dMtKmLnQWk=; b=gp0eZ4e9w/bQzJELj0jVJBHDbdnRFf0M7m1mFtlbj3Q7Dq2ty3xR1QbZ+R8dAVB1ig Ag1LFcxxUz1cyqyVinoHENPRqbV5XRlY8NpfFYc20N0/VxBEikHZymQda4sYDk/g71fd LKHnzB00N3ESOSX5DFNfnOAikFm7ImAJl5IJEw1QXUglO0hFwje3RJ/KqqZtKWa3wFoP ONEOmwqwPNxVh9qbBDc9l0NDgY45iIyC4IVMRLDdiVN7n6BpIw99s7OtZw6ts5a2+IYy yZAyDQKHxzCpUu8IJUxDlCkQz+IP1UHUAO3NzyDsGJvzPhS5qG3OUkpBNQy83SKHk+1D e0nA==
MIME-Version 1.0
X-Received by 10.50.131.196 with SMTP id oo4mr96759375igb.2.1426371618487; Sat, 14 Mar 2015 15:20:18 -0700 (PDT)
In-Reply-To <20150314220907.GA67310@cskk.homeip.net>
References <me1k2i$ljt$1@ger.gmane.org> <20150314220907.GA67310@cskk.homeip.net>
Date Sun, 15 Mar 2015 09:20:18 +1100
Subject Re: Odd ValueError using float
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.378.1426371627.21433.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1426371627 news.xs4all.nl 2948 [2001:888:2000:d::a6]:39930
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:87452

Show key headers only | View raw


On Sun, Mar 15, 2015 at 9:09 AM, Cameron Simpson <cs@zip.com.au> wrote:
> On 14Mar2015 08:28, Emile van Sebille <emile@fenx.com> wrote:
>>
>> It ran almost to completion before generating the error again --
>>
>> (Pdb) decval
>> '4'
>> (Pdb) type(decval)
>> <type 'str'>
>> (Pdb) len(decval)
>> 1
>> (Pdb) int(decval)
>> *** ValueError: invalid literal for int() with base 10:
>> '41.700000000000003'
>>
>> So there's still something amiss.
>
>
> Am I missing something obvious here? int() likes only ints, not floats:

Possibly missing the bit where decval looks to be a string containing
the one character U+0034 DIGIT FOUR, and then suddenly has a whole
mess of extra characters. :)

Check out the fenx stuff, as that's the only non-stdlib code you have.
Maybe it calls on a C extension module somewhere deep inside it.

ChrisA

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


Thread

Re: Odd ValueError using float Chris Angelico <rosuav@gmail.com> - 2015-03-15 09:20 +1100

csiph-web