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


Groups > comp.lang.python > #45781

newbie question about subprocess.Popen() arguments

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <posix.ru@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'subject:skip:s 10': 0.07; 'parameter': 0.09; 'spaces': 0.09; 'subject:question': 0.10; 'slash': 0.16; 'stdout': 0.16; 'symbols': 0.16; 'sender:addr:gmail.com': 0.17; 'trying': 0.19; 'alex': 0.19; 'import': 0.22; 'print': 0.22; 'question': 0.24; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'parameters.': 0.31; 'file': 0.32; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'skip:& 10': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'new': 0.61; 'save': 0.62; 'name': 0.63; 'different': 0.65; 'p.s.': 0.66
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=FHNL02dGPDq4AZf6nj20MJgr0j434eBxuud911Ess80=; b=y8B0f4BCGY45qHndovaNVn22xM3u664pLLRxolCxdCLKdEkADVEnwnkKoB+LHsG4ZE OlTjwrX7pfDgeJxcrpjspGcaFLmMZrSjFwOQDKJYjxsfdwMN72dx8iIMaWTlIxxoiqVK m5DSRFE7pXgE2T0Z/cKt3wWOtts5RkL9k5kFw3jflVweTXHCbb6Fl+AbVJhQHMNqsuvJ 1WOqSkQ1wAHYy8QCIgFItB9ZAtl9pbyhK2gDOUbMajKQ0qzEQyzX8inNGosHzE+XQNRN KfC9wHp1GXPzuPNyQjUmQJ3TTNE++CwdDtYI5O3MNgJzj0xlKAgaiHigJy+aBDCcAe1D 7uLA==
MIME-Version 1.0
X-Received by 10.112.163.167 with SMTP id yj7mr5822664lbb.107.1369293615568; Thu, 23 May 2013 00:20:15 -0700 (PDT)
Sender posix.ru@gmail.com
Date Thu, 23 May 2013 09:20:15 +0200
X-Google-Sender-Auth eg57hKc5aaBcIIhEaSY5ZA6IbOk
Subject newbie question about subprocess.Popen() arguments
From Alex Naumov <alexander_naumov@opensuse.org>
To python-list@python.org
Content-Type multipart/alternative; boundary=089e0115fe1a8c9df904dd5d839d
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.1998.1369293617.3114.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369293617 news.xs4all.nl 15942 [2001:888:2000:d::a6]:51484
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45781

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

I'm trying to call new process with some parameters. The problem is that
the last parameter is a "string" that has a lot of spaces and different
symbols like slash and so on. I can save it in file and use name of this
file as parameter, but my question is: how to make it without   additional
saving?

import subprocess as sp

rc = sp.Popen(["prog", "--options", "<", msg], stdin=sp.PIPE,
stdout=sp.PIPE)
stdout = rc.communicate()[0]
print stdout



Thank you,
Alex

p.s.
type(msg) => <type 'str'>

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


Thread

newbie question about subprocess.Popen() arguments Alex Naumov <alexander_naumov@opensuse.org> - 2013-05-23 09:20 +0200

csiph-web