Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'beginner': 0.05; 'debugging': 0.07; 'arguments': 0.09; 'converted': 0.09; 'literal': 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'suggestions.': 0.09; 'valueerror:': 0.09; 'python': 0.11; 'wrote': 0.14; 'expecting': 0.16; 'subject:variable': 0.16; 'accordingly.': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'command': 0.22; 'print': 0.22; 'header :User-Agent:1': 0.23; 'error': 0.23; 'integer': 0.24; 'received:emailsrvr.com': 0.24; '(or': 0.24; 'script': 0.25; 'received:(smtp server)': 0.26; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'gary': 0.31; 'int,': 0.31; 'with,': 0.31; 'file': 0.32; 'there.': 0.32; 'running': 0.33; '(most': 0.33; 'guess': 0.33; 'message.': 0.35; "can't": 0.35; 'but': 0.35; 'adjust': 0.36; 'level': 0.37; 'list.': 0.37; 'to:addr:python- list': 0.38; 'fact': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'read': 0.60; 'times': 0.62; 'email addr:gmail.com': 0.63; 'within': 0.65; 'invalid': 0.68; 'skill': 0.68; '(according': 0.84; '10:': 0.84; 'contains.': 0.84; 'examining': 0.84; 'examine': 0.93 X-Virus-Scanned: OK Date: Tue, 11 Feb 2014 11:20:27 -0800 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Flag control variable References: <5019eb5d-ebda-4417-ab2d-9a58afcdd186@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392146445 news.xs4all.nl 2835 [2001:888:2000:d::a6]:55474 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65953 On 02/11/2014 11:01 AM, luke.geelen@gmail.com wrote: > when using python script.py 2 \* 2 i get Traceback (most recent call > last): File "math2.py", line 5, in sign = int(sys.argv[2]) > ValueError: invalid literal for int() with base 10: '*' Stop trying to guess what is going on. Print out sys.argv, and *see* what values are there. Then read the error message. You wrote your script expecting sys.argv[2] to contain an int, but in fact (according to the error) it contains a '*' -- which can't be converted to an integer obviously. Your error is in running the script incorrectly, *OR* in your understanding of how the command line arguments get placed in sys.argv. In either case you best bet is to examine sys.argv by printing it (or examining it within a debugger) and *see* what values it contains. Then adjust your script (or the running of it) accordingly. These are very beginner level debugging suggestions. If you develop the skill to read and understand the error messages, and the skill to print (or otherwise examine) the values your program is dealing with, you progress will by 100's of times faster then this slow wait for someone to respond to on this list. Gary Herron