Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'say,': 0.05; 'bash': 0.07; 'deprecated': 0.07; 'except:': 0.07; 'executable': 0.07; 'command.': 0.09; 'module)': 0.09; 'open()': 0.09; 'permissions.': 0.09; 'raised.': 0.09; 'subject:into': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'echo': 0.16; 'for,': 0.16; 'mkfifo': 0.16; 'pipes': 0.16; 'subject:writing': 0.16; 'subprocess': 0.16; 'utc,': 0.16; 'wrote:': 0.17; 'equivalent': 0.20; 'permission': 0.20; 'written': 0.20; 'thanks.': 0.21; 'closely': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'wrote': 0.26; 'am,': 0.27; 'correct': 0.28; 'cat': 0.29; 'this.': 0.29; 'related': 0.30; 'error': 0.30; 'code': 0.31; '(and': 0.32; 'running': 0.32; 'print': 0.32; 'function.': 0.33; 'code:': 0.33; 'likely': 0.33; 'received:google.com': 0.34; 'replaced': 0.35; 'said,': 0.35; 'created': 0.36; 'michael': 0.36; 'but': 0.36; 'should': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'nothing': 0.38; 'hello,': 0.39; 'think': 0.40; 'your': 0.60; 'from:no real name:2**0': 0.60; 'skip:u 10': 0.60; 'telling': 0.61; 'first': 0.61; 'world': 0.63; 'ever': 0.63; 'email addr:gmail.com': 0.63; 'more': 0.63; 'believe': 0.69; '2013': 0.84; 'case?': 0.84; 'resistant': 0.84 X-Received: by 10.49.58.167 with SMTP id s7mr1455193qeq.5.1361382846955; Wed, 20 Feb 2013 09:54:06 -0800 (PST) Newsgroups: comp.lang.python Date: Wed, 20 Feb 2013 09:54:06 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=86.9.199.73; posting-account=EvoLHwoAAAAe6MGgc84vdAuhA1J1BvTN References: <76620a9e-45fe-499d-b1bf-06b1d2a91c25@googlegroups.com> <16e85bd1-6e5d-4d70-95bf-cc6b986a9f7c@googlegroups.com> <8f26ac4d-4732-46ac-bf4e-877696b22241@googlegroups.com> <85cd2254-0800-4448-9117-9175bbfd10f6@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 86.9.199.73 MIME-Version: 1.0 Subject: Re: improving performance of writing into a pipe From: mikprog@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org 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: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361385285 news.xs4all.nl 6928 [2001:888:2000:d::a6]:40797 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39371 On Tuesday, February 19, 2013 5:47:16 PM UTC, Michael Torrie wrote: > On 02/19/2013 02:24 AM, mikprog@gmail.com wrote: > > > Or rather: what would you try to catch in this particular case? > > > As Peter said, nothing for now. But you seem very resistant to telling > > us what exception was raised. Michael believe me: I am not resistant or try to hide anything! As written before, I don't know what exception to search for, so I wrote the (wrong) code: except: print "error" Let's why I don't have a clue about it. But someone already explained me that I should not do this. > > Though looking at your code more closely I can see that likely the error > > is related to the fact that /tmp/mypipe is not an executable program. Yes it is and has rwx permissions. Unfortunately I don't have access to the code in the pipe. > > popen (which is deprecated and replaced by the subprocess module) is for > > running programs and communicating with them over pipes created by the > > popen function. So your code is not likely to ever work as it is > > presently given. > > > > Here's the bash equivalent of your code: > > > > $ mkfifo /tmp/path > > $ cat > $ echo hello, world | /tmp/path > > > > Bash will say, "bash: /tmp/path: Permission denied" > > > > The correct bash line is: > > $ echo hello, world > /tmp/path > > > > popen() (and subprocess) is the equivalent of the first bash command. > > open() is the equivalent of the second line. > > Do you understand the difference? I think I do now, thanks. mik