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


Groups > comp.lang.python > #7393

Re: Question About Command line arguments

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'pm,': 0.10; 'output': 0.11; 'wrote:': 0.14; '-tkc': 0.16; '<--': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 0.16; 'phillips': 0.16; 'picks': 0.16; 'argument': 0.16; 'input': 0.17; 'cc:addr:python-list': 0.17; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'subject:Question': 0.25; 'script': 0.27; 'cc:addr:python.org': 0.30; 'header:User-Agent:1': 0.35; 'skip:o 20': 0.37; 'subject:: ': 0.38; 'received:209': 0.39; 'subject:About': 0.68; 'subject:line': 0.73
Date Fri, 10 Jun 2011 13:31:19 -0500
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version 1.0
To Mark Phillips <mark@phillipsmarketing.biz>
Subject Re: Question About Command line arguments
References <BANLkTi==QHd+5C=xf+2Re1Mh4V6Hk972hg@mail.gmail.com> <4DF25738.2020704@mrabarnett.plus.com> <BANLkTimHfZK=FsbSs4BOX8dU=mt2bVGV9A@mail.gmail.com>
In-Reply-To <BANLkTimHfZK=FsbSs4BOX8dU=mt2bVGV9A@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Source
X-Source-Args
X-Source-Dir
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.93.1307730688.11593.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 82.94.164.166
X-Trace 1307730688 news.xs4all.nl 49044 [::ffff:82.94.164.166]:45016
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7393

Show key headers only | View raw


On 06/10/2011 12:58 PM, Mark Phillips wrote:
> How do I write my script so it picks up argument from the
> output of commands that pipe input into my script?

You can check

   if os.isatty(sys.stdin):  # <-- this check
     do_stuff_with_the_terminal()
   else:
     read_options_from_stdin()

-tkc


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


Thread

Re: Question About Command line arguments Tim Chase <python.list@tim.thechases.com> - 2011-06-10 13:31 -0500

csiph-web