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


Groups > comp.lang.python > #73309 > unrolled thread

Re: line to argv transformation

Started byAntoon Pardon <antoon.pardon@rece.vub.ac.be>
First post2014-06-16 12:24 +0200
Last post2014-06-16 12:24 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#73309 — Re: line to argv transformation

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2014-06-16 12:24 +0200
SubjectRe: line to argv transformation
Message-ID<mailman.11081.1402914290.18130.python-list@python.org>
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
>>> 

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web