Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'exit': 0.07; 'cmd': 0.09; 'python:': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'cc:name:python list': 0.16; 'subprocess': 0.16; 'string': 0.17; 'issue,': 0.17; 'shell': 0.18; 'issue.': 0.20; 'file.': 0.20; 'runs': 0.22; 'example': 0.23; 'seems': 0.23; 'cc:2**1': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'cc:addr:gmail.com': 0.27; 'fine': 0.28; 'this.': 0.29; 'maybe': 0.29; 'worked': 0.30; 'call.': 0.30; 'query': 0.30; 'code': 0.31; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'anything': 0.36; "i'll": 0.36; 'should': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'called': 0.39; 'help': 0.40; 'behavior': 0.64; 'injecting': 0.84; 'pasting': 0.84; 'frustrating': 0.91; 'cutting': 0.93 Newsgroups: comp.lang.python Date: Tue, 18 Dec 2012 12:52:58 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=184.3.12.136; posting-account=dXBr0AoAAAA4oVLc496_o3WhhWAWHS9M References: <50cbac6d$0$29991$c3e8da3$5496439d@news.astraweb.com> <8757bcac-76ac-4b15-9410-dc61d7a8c641@googlegroups.com> <0e224780-b84f-4f72-9c95-bc55cde8b183@googlegroups.com> <6ff54b92-70f1-44fb-a5a5-17133e1a6faa@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 184.3.12.136 MIME-Version: 1.0 Subject: Re: os.system and subprocess odd behavior From: py_genetic To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python List , py_genetic 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: , Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355866669 news.xs4all.nl 6918 [2001:888:2000:d::a6]:56017 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35074 Solved the issue, by injecting the query into the cmd line. Shell script w= orked fine as if I was cutting and pasting to the prompt. Seems to still b= e something with the subprocess receiving and exit code before or when the = query finishes, just when I ask to to read from the .SQL file. example called from in python: mysql .... < file.txt > out.txt <---- doesn't work (query is run 0Byte out= put) mysql .... -e "my query" > out.txt <----- does work However this isn't standard mysql as it's infinidb. Maybe this is an esote= ric issue. Thanks for the help Oscar. Frustrating since it seems illogical.... seems = if the cmd runs in the shell it should have the exact same behavior from a = subprocess shell=3DTrue cmd string call. If I find anything else I'll update this.