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


Groups > comp.lang.python > #41948

Re: problem with sys import argv

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.106
X-Spam-Level *
X-Spam-Evidence '*H*': 0.79; '*S*': 0.00; 'python': 0.11; 'argument,': 0.16; 'op.': 0.16; 'proportion': 0.16; 'received:74.208.4.195': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; 'code,': 0.22; 'header:User-Agent:1': 0.23; 'instead.': 0.24; 'subject:problem': 0.24; 'url:dev': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; "skip:' 10": 0.31; 'run': 0.32; 'url:python': 0.33; 'subject:with': 0.35; 'beyond': 0.35; 'but': 0.35; 'url:org': 0.36; 'should': 0.36; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'dave': 0.60; 'tell': 0.60; 'interest': 0.64; 'thomas': 0.65; 'received:74.208': 0.68; 'therefore': 0.72; 'presumably': 0.84; 'angel': 0.91
Date Tue, 26 Mar 2013 16:48:36 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4
MIME-Version 1.0
To python-list@python.org
Subject Re: problem with sys import argv
References <A33EC90F-DEC4-424D-BDBF-68165669A336@icloud.com> <mailman.3764.1364320531.2939.python-list@python.org> <7378582.EtEbenrJl9@PointedEars.de>
In-Reply-To <7378582.EtEbenrJl9@PointedEars.de>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:aMDcZ2H6o3fQS1aDVAEcUZ0IpADmsrkijPk1RHXZ/oF LwYC6t/opEJW8wDbss2nXNoBPWXsM8kfaE+Yn2OL3u4mOf4RFU NdHWeqOZFZV50bOyD6EUirYwecO1Xq8Arzp5pO/5PHhS149EUJ 17fBoAyR3FG4ap8ed88Rsk5xSV9v3vcksM8lwh6ERaLJ1r97is N5d3WDrVrZEMrtN/nIHJalV1T4ePHrFD+RS1ztRmSdWc/3g5wJ jsj2P5suN5mIFezWQEe9nXOrcAm9xdOeLjR1aTKCl9vq4QTXOS J9QEezY0i2/dIkh6blt8cULo6cXHsPUL05TNJsNg0texX4Xuw= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3773.1364330936.2939.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364330936 news.xs4all.nl 6943 [2001:888:2000:d::a6]:55679
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41948

Show key headers only | View raw


On 03/26/2013 04:12 PM, Thomas 'PointedEars' Lahn wrote:
> Dave Angel wrote:
>
>> Since the script takes a mandatory argument, run it with one.
>>
>> python  myscript.py  Dave
>>
>> Better would be to change the script to check len(argv) for exactly 2,
>> and tell the user how he should have run it.
>
> I would use argparse.ArgumentParser instead.
>
> <http://docs.python.org/dev/library/argparse.html>
>

As would I.  But that would be out of proportion of the rest of the 
code, and therefore presumably beyond the needs or interest of the OP.

-- 
DaveA

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


Thread

Re: problem with sys import argv Dave Angel <davea@davea.name> - 2013-03-26 13:55 -0400
  Re: problem with sys import argv Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-26 21:12 +0100
    Re: problem with sys import argv Dave Angel <davea@davea.name> - 2013-03-26 16:48 -0400

csiph-web