Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'works.': 0.07; "'w')": 0.09; 'subject:into': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'line)': 0.16; 'subject:writing': 0.16; 'fix': 0.17; 'pipe': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "skip:' 10": 0.30; 'everyone': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'subject:: ': 0.38; 'from:no real name:2**0': 0.60; 'else.': 0.65 X-Received: by 10.49.96.196 with SMTP id du4mr1152978qeb.37.1361281199535; Tue, 19 Feb 2013 05:39:59 -0800 (PST) Newsgroups: comp.lang.python Date: Tue, 19 Feb 2013 05:39:59 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=92.40.254.242; posting-account=EvoLHwoAAAAe6MGgc84vdAuhA1J1BvTN References: <76620a9e-45fe-499d-b1bf-06b1d2a91c25@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 92.40.254.242 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361281202 news.xs4all.nl 6981 [2001:888:2000:d::a6]:58255 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39219 > > def write_to_pipe(line): > > hexbytes = ''.join('\\x%02x' % ord(c) for c in line) > > with open('/tmp/mypipe', 'w') as f: > > f.write(hexbytes) Update: with a fix in the pipe THIS was the right way to do it, and it now works. Thanks a lot Serhiy to you and to everyone else. Mik