Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101168 > unrolled thread
| Started by | Carlos Barera <carlos.barera@gmail.com> |
|---|---|
| First post | 2016-01-02 20:39 +0000 |
| Last post | 2016-01-02 20:39 +0000 |
| 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.
Re: subprocess check_output Carlos Barera <carlos.barera@gmail.com> - 2016-01-02 20:39 +0000
| From | Carlos Barera <carlos.barera@gmail.com> |
|---|---|
| Date | 2016-01-02 20:39 +0000 |
| Subject | Re: subprocess check_output |
| Message-ID | <mailman.179.1451767167.11925.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web