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


Groups > comp.lang.python > #73309

Re: line to argv transformation

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <antoon.pardon@rece.vub.ac.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:134': 0.05; 'subject:skip:t 10': 0.09; 'api': 0.11; 'def': 0.12; 'typeerror:': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'skip:p 30': 0.29; "doesn't": 0.30; '"",': 0.31; 'idea,': 0.31; 'file': 0.32; '(most': 0.33; 'skip:s 30': 0.35; 'to:addr:python- list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result AqIEAK7DnlOGuA9G/2dsb2JhbABahyW9GoMSAYEohHgBAQQBI1UGCwsaAgUWCwICCQMCAQIBRRMIAog2CLEPmGWFJheBKo1TFoJhgUwBA5pDhmOMdYNC
Date Mon, 16 Jun 2014 12:24:47 +0200
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.5.0
MIME-Version 1.0
To python-list@python.org
Subject Re: line to argv transformation
References <539EBF61.4050106@rece.vub.ac.be> <CAPTjJmqd74v013WwG2QrZP2y9N+gMk0TK5xT5-yy3=8gOuAs4g@mail.gmail.com>
In-Reply-To <CAPTjJmqd74v013WwG2QrZP2y9N+gMk0TK5xT5-yy3=8gOuAs4g@mail.gmail.com>
Content-Type text/plain; charset=UTF-8
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.11081.1402914290.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1402914290 news.xs4all.nl 2975 [2001:888:2000:d::a6]:49668
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73309

Show key headers only | View raw


On 16-06-14 12:06, Chris Angelico wrote:

> def shell_split(cmd):
>     return subprocess.check_output("""python -c 'import sys;
> print("\\0".join(sys.argv[1:]))' """+cmd,shell=True)[:-1].split("\0")

Nice idea, unfortunatly it doesn't work in python3.3

>>> shell_split("ls *.py")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in shell_split
TypeError: Type str doesn't support the buffer API
>>> 

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


Thread

Re: line to argv transformation Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-06-16 12:24 +0200

csiph-web