Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: subprocess check_output Date: Thu, 31 Dec 2015 09:32:48 +1100 Lines: 24 Message-ID: References: <20151230210227.GA88234@cskk.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de xVSyRWA3+AWkCuAmuYXKjgbNY7v7HDiBixbqB6pqhXhw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'executable': 0.07; 'skip:/ 10': 0.07; 'thu,': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:209.85.213.176': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'simpson': 0.16; 'something.': 0.16; 'wrote:': 0.16; 'runs': 0.18; '2015': 0.20; 'to:name:python-list@python.org': 0.20; '31,': 0.22; 'trying': 0.22; 'am,': 0.23; 'dec': 0.23; 'tried': 0.24; 'header:In-Reply- To:1': 0.24; 'all.': 0.24; 'script': 0.25; 'command': 0.26; 'installed': 0.26; 'skip:" 20': 0.26; 'message- id:@mail.gmail.com': 0.27; 'environment': 0.29; 'checks': 0.30; 'getting': 0.33; 'run': 0.33; 'ubuntu': 0.33; 'file': 0.34; 'worked': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'exist': 0.35; 'path': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'confirm': 0.62; 'providing': 0.62; 'cameron': 0.66; 'chrisa': 0.84; 'carlos': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=jZ5TkAxc1Uqkbud91j6ldrgp4eRoMoKyKDW+enheVVs=; b=eM1Aj4tfUZwl5OyxY906fN71rkZngu6guSZy7go5P5J38O3jjCeZpukmWvTERm5MsL eTeLZTYpAi/S3xImf+IM43cXlDUAet3j10a/OgiiDby0WH1Z75fL+rHNSNo/BhO+LdCJ XJVjCOzVtR8U317tuFsXD1FwIrLoM2oCeypqhEL9bcEFyNyuLXTeLzKvDxGNV1Sh2B4G sE2JTyw5MukIneOVNRXI055B4+ZHJHto2SzylXceo5gNRpO0uZNEZDDqmvHIm969JE4/ 1my7uxYJ6YWeaz5cz4SI7g3MsnDBJGdO9XSTGuiZcvMeKZN9m0FixAdtkYWDEHly8H5x hHuw== X-Received: by 10.50.60.6 with SMTP id d6mr11111706igr.94.1451514769208; Wed, 30 Dec 2015 14:32:49 -0800 (PST) In-Reply-To: <20151230210227.GA88234@cskk.homeip.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101015 On Thu, Dec 31, 2015 at 8:02 AM, Cameron Simpson wrote: > On 30Dec2015 21:14, Carlos Barera 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? And do those checks as the same user as your script runs as, with the same environment and all. You might find that a file is executable for one user but not for another, or something. ChrisA