Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101168
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Carlos Barera <carlos.barera@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: subprocess check_output |
| Date | Sat, 02 Jan 2016 20:39:09 +0000 |
| Lines | 47 |
| Message-ID | <mailman.179.1451767167.11925.python-list@python.org> (permalink) |
| References | <CAJYwLU=p_U3V7MfOx3wCH8qkamK0aSHzF1i0g2ZBgTXDgrF03Q@mail.gmail.com> <20151230210227.GA88234@cskk.homeip.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de t1bQpDbIR1pzQRfuigSFGwH6gu9ef88QRe6+LEEc1W9Q== |
| Return-Path | <carlos.barera@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.014 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'failing': 0.05; 'bash': 0.07; 'scripts': 0.09; 'portable': 0.09; 'wed,': 0.15; '...)': 0.16; '/bin/sh': 0.16; 'bash,': 0.16; 'bourne': 0.16; 'reason.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'shell:': 0.16; 'simpson': 0.16; 'transcript': 0.16; 'wrote:': 0.16; '>': 0.18; 'email addr:gmail.com>': 0.18; '2015': 0.20; 'parameter': 0.22; 'dec': 0.23; 'thanks,': 0.24; 'tried': 0.24; 'plain': 0.24; 'unix': 0.24; 'header:In-Reply-To:1': 0.24; 'command': 0.26; 'installed': 0.26; '(which': 0.26; 'linux': 0.26; 'skip:" 20': 0.26; 'message-id:@mail.gmail.com': 0.27; 'finally,': 0.27; 'turns': 0.27; 'does,': 0.29; 'code': 0.30; 'skip:& 30': 0.30; 'skip:s 30': 0.31; 'getting': 0.33; 'run': 0.33; 'common': 0.33; 'file': 0.34; 'worked': 0.34; 'running': 0.34; 'server': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'exist': 0.35; 'path': 0.35; 'skip:> 10': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; "wasn't": 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'thought': 0.37; 'received:209': 0.38; 'drop': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'provide': 0.61; 'spam.': 0.61; 'confirm': 0.62; 'providing': 0.62; '30,': 0.63; 'benefit': 0.66; 'cameron': 0.66; 'reply': 0.68; 'subject': 0.70; 'special': 0.73; '11:02': 0.84; 'fetish': 0.84; 'carlos': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=f9ZXMCucjN0SVEbpShoNieb2+w534i3fNePBZRrZxco=; b=bE8158gAzC/qIpRmIqeI54/+A5rhvmQNg3CvHZoCy7m7gXPZr1rKYYn3294m8qKOYP j4uddNIFw6Jz0LdfAMXYrB3mExObtd9iSAZQFgWnGxMtIQOYu79Suy/YeD2LOUdEtWn7 mj54m6hABK5j2KmKROweQ/s+nFdgxxPvTBrmStnL1wsrzCyhHfjPzcDv4DOaK3sxMZ5c SiZN6d2XOJdgXMdph9CacXQyK0eCcgueJaqV72Eqn+u3HDwJgWe26ZR0YGIgqubo1fsC ILnRppuggGr/48jYyFMeBPD9XBknwyyearwZxjEpwOca7YYW5pd4A02AM3a01Y9yCxAk WBKA== |
| X-Received | by 10.112.190.67 with SMTP id go3mr2636448lbc.59.1451767158966; Sat, 02 Jan 2016 12:39:18 -0800 (PST) |
| In-Reply-To | <20151230210227.GA88234@cskk.homeip.net> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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> |
| Xref | csiph.com comp.lang.python:101168 |
Show key headers only | View raw
Turns out it wasn't running against the server I thought it was. Apologies for the spam. -carlos On Wed, Dec 30, 2015 at 11:02 PM Cameron Simpson <cs@zip.com.au> wrote: > On 30Dec2015 21:14, Carlos Barera <carlos.barera@gmail.com> wrote: > >Trying to run a specific command (ibstat) installed in /usr/sbin on an > >Ubuntu 15.04 machine, using subprocess.check_output and getting "/bin/sh: > >/usr/sbin/ibstat: No such file or directory" > > > >I tried the following: > >- running the command providing full path > >- running with executable=bash > >- running with (['/bin/bash', '-c' , "/usr/sbin/ibstat"]) > > > >Nothing worked ... > > The first check is to run the command from a shell. Does it work? Does > "which > ibstat" confirm that the command exist at that path? Is it even installed? > > If it does, you should be able to run it directly without using a shell: > > subprocess.call(['/usr/sbin/ibstat'], ...) > > or just plain ['ibstat']. Also remember that using "sh -c blah" or "bash -c > blah" is subject to all the same security issues that subprocess' > "shell=True" > parameter is, and that it should be avoided without special reason. > > Finally, remember to drop the common Linux fetish with "bash". Just use > "sh"; > on many systems it _is_ bash, but it will provide portable use. The bash is > just a partiular Bourne style shell, not installed everywhere, and rarely > of > any special benefit for scripts over the system /bin/sh (which _every_ UNIX > system has). > > If none of this solves your problem, please reply including the failing > code > and a transcript of the failure output. > > Thanks, > Cameron Simpson <cs@zip.com.au> >
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: subprocess check_output Carlos Barera <carlos.barera@gmail.com> - 2016-01-02 20:39 +0000
csiph-web