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


Groups > comp.lang.python > #56854

Problem calling script with arguments

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <mailinglists@xgm.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.05; 'arguments': 0.09; 'output,': 0.09; 'received:localnet': 0.09; 'skip:$ 30': 0.09; 'skip:/ 10': 0.09; 'subject:script': 0.09; 'proc': 0.16; 'right:': 0.16; 'subject:Problem': 0.16; 'help.': 0.21; 'input': 0.22; 'header:User-Agent:1': 0.23; 'source': 0.25; 'script': 0.25; 'skip:" 20': 0.27; 'perl': 0.31; 'file': 0.32; 'thanks!': 0.32; 'open': 0.33; 'skip:# 10': 0.33; 'subject:with': 0.35; "can't": 0.35; 'something': 0.35; 'received:google.com': 0.35; 'charset:us-ascii': 0.36; 'skip:[ 10': 0.38; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'read': 0.60; 'such': 0.63; 'florian': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=xgm.de; s=google; h=from:to:subject:date:message-id:user-agent:mime-version :content-transfer-encoding:content-type; bh=aUTCxsNug2IbjmTyVXa+v9cOgxiTxAI3CyV9Al55rGE=; b=ABke56W1stmI421kKqAKZ6E8LwEpsZV6Qfrlp+EcWfQwkYp+LXl2tLkNxBL3JRvRIR 4md2ptGcpMdSfuLUKSluAgqDoRJ8AVXMQ2N3Bwrl37fHyEAIuHc4VnQidkmmopLJ4AVh ZmwBrd60CbCE7u/KlmtEXtwlLbAbFutCqbqQs=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-transfer-encoding:content-type; bh=aUTCxsNug2IbjmTyVXa+v9cOgxiTxAI3CyV9Al55rGE=; b=La253t9W0u4mNlM3Y4La5y3xI7GXMnvOvSEJd580zsjIaP0v9LWQZgq11B30hOZGtg CGppbnUNYQfGZR58HmN2zZle28xyI9qXGslb/eInbjq+wq8L2EaZdaRmTPkDzB5tpPkQ H2neP57rvy5/HhjKkzv0EkKgzxeTHXPHeiYjLvcwVrSSmy6B6aIgmKvBEBKmlqMFpp4p +zwEoUWX9N2Vl0hXWb/amyP1tzGL+zs1YAdR3mDYnb+577x8iMQb++yHxrYLo4J5mDm/ T4K/QF3OvB466TxdMSZcxXyaQJQRmcMxSMObfq6JMCibcZR78/3C33BibyHOvat0nOII Fouw==
X-Gm-Message-State ALoCoQnbNny49QXX9rZrKm+7Gd7CveXiXxnrToe27RLCTAOCcwyr5N3xgOH+0zz+FVv82pkeOcSH
X-Received by 10.204.2.140 with SMTP id 12mr195089bkj.47.1381857225805; Tue, 15 Oct 2013 10:13:45 -0700 (PDT)
From Florian Lindner <mailinglists@xgm.de>
To python-list@python.org
Subject Problem calling script with arguments
Date Tue, 15 Oct 2013 19:13:32 +0200
User-Agent KMail/4.11.2 (Linux/3.11.5-1-ARCH; KDE/4.11.2; x86_64; ; )
MIME-Version 1.0
Content-Transfer-Encoding 7Bit
Content-Type text/plain; charset="us-ascii"
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.1099.1381857234.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1381857234 news.xs4all.nl 15936 [2001:888:2000:d::a6]:47685
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:56854

Show key headers only | View raw


Hello,

I have a 3rd party perl script:

 head -n 1 /usr/sbin/ftpasswd
#!/usr/bin/perl

I want to write data to stdin and read from stdout:

proc = Popen( ["/usr/bin/perl", "/usr/sbin/ftpasswd" "--hash", "--stdin"], 
stdout=PIPE, stdin=PIPE)

output, input = proc.communicate(pwd)
return output.strip()

Since pwd comes from a non-trusted source I don't want to use shell=True.

The arguments to the perl interpreter do not seem to right:

Can't open perl script "/usr/sbin/ftpasswd--hash": No such file or directory

Adding a leading " " to "--hash" does not help.

How can I use that script and achieve something like

# echo "123" | ftpasswd --hash --stdin
ftpasswd: $1$8BuLAqCl$y/URBN/OCSLsKtnu8nFHH0

Thanks!

Florian

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


Thread

Problem calling script with arguments Florian Lindner <mailinglists@xgm.de> - 2013-10-15 19:13 +0200

csiph-web