Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(at': 0.04; 'odd': 0.07; 'string': 0.09; 'converted': 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'so?': 0.09; 'python': 0.11; '10:59': 0.16; 'integer.': 0.16; 'least)': 0.16; 'script,': 0.16; 'subject:variable': 0.16; 'wrote:': 0.18; 'value.': 0.19; 'not,': 0.20; 'command': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'expanded': 0.24; 'received:emailsrvr.com': 0.24; 'question': 0.24; 'received:(smtp server)': 0.26; 'skip:" 30': 0.26; 'least': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'character': 0.29; '(on': 0.31; 'gary': 0.31; 'run': 0.32; 'quite': 0.32; 'linux': 0.33; 'becomes': 0.33; 'trouble': 0.34; 'message.': 0.35; "can't": 0.35; 'problem.': 0.35; 'something': 0.35; 'usual': 0.35; 'but': 0.35; "didn't": 0.36; 'list': 0.37; 'being': 0.38; 'to:addr :python-list': 0.38; 'files': 0.38; 'that,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'is.': 0.60; 'most': 0.60; 'tell': 0.60; 'course': 0.61; "you'll": 0.62; 'email addr:gmail.com': 0.63; 'such': 0.63; 'manner': 0.72; 'us,': 0.73; 'asterisk': 0.84 X-Virus-Scanned: OK Date: Tue, 11 Feb 2014 11:09:22 -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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392145780 news.xs4all.nl 2943 [2001:888:2000:d::a6]:45070 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65950 On 02/11/2014 10:59 AM, luke.geelen@gmail.com wrote: > > > Look at the error message. Carefully! It says, quite clearly, the call > > to int is being passed a string "Adafruit-Raspberry-Pi-Python-Code", > > which of course can't be converted to an integer. > > > > Now the question is how you ran the program in such a manner that > > sys.argv[3] has such an odd value. > > What does your command line look like? You didn't tell us, but that's > > where the trouble is. > > > > Gary Herron > how do you meen "what does your command line look like?" When you run this python script, *how* do you do so? Perhaps you type something like: python script.py 21 '*' 42 If not, then how do you supply values for the script's sys.argv? If it is like that, then I see the most likely potential problem. The asterisk character (on Linux at least) is considered a wild-card character -- it is replaced by a list of local files so your command becomes python script.py 21 somefile1 somefile2 somefile3 <...and so on.> 42 If you put it in quotes, then it won't be expanded (at least in the usual Linux shells -- you system may vary) and you'll end up with the asterisk in sys.argv[2] and the number in sys.argv[3]. Gary Herron