Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'root': 0.04; 'executed': 0.07; 'exit': 0.07; 'permissions': 0.07; 'raises': 0.07; 'python': 0.09; 'cmd': 0.09; 'command.': 0.09; 'happen?': 0.09; 'permissions.': 0.09; 'cc:addr:python-list': 0.10; 'portion': 0.13; 'dec': 0.15; 'result.': 0.15; 'case...': 0.16; 'cc:name:python list': 0.16; 'fine.': 0.16; 'written.': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'code.': 0.20; 'posted': 0.22; 'runs': 0.22; 'cc:2**0': 0.23; 'seems': 0.23; 'somewhere': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; '(see': 0.27; 'thoughts': 0.27; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'actual': 0.28; 'run': 0.28; 'cat': 0.29; 'skip:q 20': 0.29; 'steven': 0.29; "i'm": 0.29; 'query': 0.30; 'received:209.85.215.46': 0.30; 'error': 0.30; 'code': 0.31; 'gets': 0.32; 'december': 0.32; 'file': 0.32; 'running': 0.32; 'zero': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'confirmed': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'created': 0.36; 'but': 0.36; 'test': 0.36; 'why': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'your': 0.60; 'first': 0.61; '(that': 0.62; 'access?': 0.84; 'moves': 0.84; 'oscar': 0.84; 'verifying': 0.84; 'glad': 0.86 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 :cc:content-type:content-transfer-encoding; bh=Sq8TJTyVU1MkpnHi+toUtbAC/IIfUazHJDH7Q+C7jFs=; b=SUcKvPAmbjkuNKq/FVls2JOozaF4tNwzHw6mF72tJinJF0Nou6m45XFLdMpEnNKLbq uZ+zp6+524pF6ff/WyhU7mF+t6TOISiqHNHhLYR+eZQNj4O277b+fzipSDt4w4AZNP1i blmYOYIWTm/Md+FqzCkCmBQ+Dn2WlbQYueE/cTYOQeePuzaT3jImTrye1M5vuDuNhRMT 1niS/9u7XDUymFVk0pgQJftk8Tzyia65AkCO3VFm1uWMkMggygJCpvjdjLTMQ6LUzW/F VQ1YNSMJ2TdRsiZLLn3NkoZ+/8yhoddMXjeVEl35LJM0nr/lCeBnARsoxNsj19ikhn73 yMsw== MIME-Version: 1.0 In-Reply-To: <8757bcac-76ac-4b15-9410-dc61d7a8c641@googlegroups.com> References: <50cbac6d$0$29991$c3e8da3$5496439d@news.astraweb.com> <8757bcac-76ac-4b15-9410-dc61d7a8c641@googlegroups.com> Date: Mon, 17 Dec 2012 17:16:44 +0000 Subject: Re: os.system and subprocess odd behavior From: Oscar Benjamin To: py_genetic Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355764606 news.xs4all.nl 6857 [2001:888:2000:d::a6]:43601 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34992 On 17 December 2012 16:39, py_genetic wrote: > Thanks for verifying this for me Steven. I'm glad you are seeing it work= . It's really the strangest thing. > > The issue seems to be with the " > outfile.txt" portion of the command. > > The actual command is running a query on a verticalDB and dumping the res= ult. The EXACT command run from the command line runs just fine. > > Even if I use the simple cat command to and out file as just a simple tes= t case... The file is created with zero bytes (see below)... but its as if= python moves on or gets an 0 exit code after the first part of the cmd is = executed and no data is written. > > -rw-r--r-- 1 root root 0 Dec 14 15:33 QUAD_12142012203251.TXT > > Any thoughts as to why on my end this may happen? Because of the root permissions on the file? What happens if you write to a file that doesn't need privileged access? Instead of running the "exact command", run the cat commands you posted (that Steven has confirmed as working) and run them somewhere in your user directory without root permissions. Also you may want to use subprocess.check_call as this raises a Python error if the command returns an error code. Oscar