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


Groups > comp.lang.python > #108935

Re: what is new with int conversion in Python 3

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: what is new with int conversion in Python 3
Date Sun, 22 May 2016 17:51:51 +1000
Lines 34
Message-ID <mailman.91.1463903520.27390.python-list@python.org> (permalink)
References <648b46dc-c962-4f95-83bc-faa65ae3c51a@googlegroups.com> <CAPTjJmqHATYTMe0HiMKpXpDgkseWyS_D-U_XKcYKkz_ZEwVg=Q@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de mrfGs9kJ9peEjixgwOvZZQbv01/oZofZZPWstc+OJyRA==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'failing': 0.05; 'line:': 0.07; 'skip:/ 10': 0.07; 'valueerror:': 0.07; 'cc:addr:python-list': 0.09; '22,': 0.09; 'literal': 0.09; 'valueerror': 0.09; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'invoking': 0.16; 'last)': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'python?': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'python"': 0.22; 'consistent': 0.23; 'import': 0.24; '(most': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'message- id:@mail.gmail.com': 0.27; 'looks': 0.29; 'decimal': 0.29; 'subject:what': 0.29; 'run': 0.33; 'changed': 0.33; 'int': 0.33; 'rule': 0.33; 'traceback': 0.33; 'file': 0.34; 'except': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'done': 0.35; 'something': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'should': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'google': 0.39; 'where': 0.40; 'subject:with': 0.40; 'space': 0.40; 'some': 0.40; 'here.': 0.62; 'fact,': 0.67; 'answer.': 0.72; 'carefully': 0.72; '--->': 0.84; 'all;': 0.84; 'chrisa': 0.84; 'received:74.125.82.41': 0.84; 'sort.': 0.84; 'to:none': 0.91; 'before?': 0.93
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; bh=ahjbPNXiFEr7v9Rv82DxFBfIUvjLcHoJYTkbsdqHxgY=; b=Ehb42vqSJUvSbYPkVr93WzBIY8sqNfOS4CubehSuG/Q85R43Dd2aUaZOXkqZCHQqT7 5Ulec0tGniCPJ4abXi8A6Wt8Sybc4S5e2/ek8PnQjLESsaWBEnc0JBlHnBPLBmYxsFtP Y4NhTW2IHba6psDbB0HcslJdFMq4DdFN9j3dMzlaMUuVyCDFn4flDUvqEuRCEwr8k19M H7NI5CRE+LNkYw7O9D7ylsy4WniO91oaRKVYKTsRNLuuZfgTZKkFddpb5nbjK2KocdhI ZtzfNX9wBL+OpS8q39C4J0Tl0ogPP+waEbBoWi7z7WzGJ9a42UJc1Pgg9Zz8/trETqqB bQlA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=ahjbPNXiFEr7v9Rv82DxFBfIUvjLcHoJYTkbsdqHxgY=; b=f/aTvnWUgI4GyTOVSyevIU6IH54NsLauBx8JQJSoJLPoSfBAx059UJqqKEyGFvRhvJ WlFCpFAr7u1bqbbaKTIoouAcbiBJYquXaiq07Wrg44p9sX+i/c63FeYFzMbr3qwiqLSQ EzrXEOdc4X86WoyAvq+u+0ceu7wVYyx354TqLueZ+Y++qwGbPb2zSq9GKFxVuuUkOWLA Qw9SNZJ2CivIgf5olpURmkSuF0/iON77+McUO7jr35chBsg5GozeTkezVCak2K70wjWl 382ueCbZusgfwdD1xznM1mlcteTCot7l7WiLQjui565BMOSj8eSyMstmbkw7FU2R/L29 NuSw==
X-Gm-Message-State AOPr4FXEZIaoMnMJi9jq3sthW+LiqTr9D7mT6cXQ9R6lykeDofvSyhlOjICNVQyNBMNLyXGlGxSpO24QldzLIg==
X-Received by 10.194.110.234 with SMTP id id10mr10626205wjb.30.1463903512038; Sun, 22 May 2016 00:51:52 -0700 (PDT)
In-Reply-To <648b46dc-c962-4f95-83bc-faa65ae3c51a@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <CAPTjJmqHATYTMe0HiMKpXpDgkseWyS_D-U_XKcYKkz_ZEwVg=Q@mail.gmail.com>
X-Mailman-Original-References <648b46dc-c962-4f95-83bc-faa65ae3c51a@googlegroups.com>
Xref csiph.com comp.lang.python:108935

Show key headers only | View raw


On Sun, May 22, 2016 at 5:26 PM, Sayth Renshaw <flebber.crue@gmail.com> wrote:
> However when I run this I get a valuerror. So either something has changed with int or datetime I cannot google a consistent answer.
>
>
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
> <ipython-input-8-a54a878f293d> in <module>()
>      37    return c
>      38
> ---> 39 size = int(sys.argv[1])
>      40
>      41 start = datetime.now()
>
> ValueError: invalid literal for int() with base 10: '-f'
>
> Had this before?

Look carefully at the error, and the line that it's coming up on.
Firstly, you can rule out datetime, as nothing has been done with
datetime except import it. Secondly, the invalid literal doesn't look
like a decimal number at all; in fact, it looks to me like a flag of
some sort. Try adding this above the failing line:

print(sys.argv)

And also, try running this at the terminal:

$ file /usr/bin/env/python

How are you invoking Python? The shebang looks wrong; perhaps it
should be "/usr/bin/env python" (note the space where you have an
additional slash), but perhaps it's not even being significant here.

ChrisA

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


Thread

what is new with int conversion in Python 3 Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-22 00:26 -0700
  Re: what is new with int conversion in Python 3 Chris Angelico <rosuav@gmail.com> - 2016-05-22 17:51 +1000
  Re: what is new with int conversion in Python 3 Steven D'Aprano <steve@pearwood.info> - 2016-05-22 17:55 +1000
  Re: what is new with int conversion in Python 3 Peter Otten <__peter__@web.de> - 2016-05-22 10:32 +0200
  Re: what is new with int conversion in Python 3 Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-22 03:59 -0700

csiph-web