Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!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; 'else:': 0.03; 'args': 0.07; 'binary': 0.07; 'to)': 0.09; 'try:': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'e.errno': 0.16; 'errno.epipe': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'input:': 0.16; 'ioerror': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'occurred.': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'self.stdin': 0.16; 'simpson': 0.16; 'subject:ideas': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'passing': 0.19; 'input': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'script.': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'mode': 0.30; 'skip:= 40': 0.31; 'probably': 0.32; 'interface': 0.32; 'text': 0.33; 'open': 0.33; 'skip:_ 10': 0.34; 'problem': 0.35; 'except': 0.35; 'received:com.au': 0.36; 'sequence': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'should': 0.36; 'being': 0.38; 'received:211': 0.38; 'whatever': 0.38; 'does': 0.39; 'called': 0.40; "you're": 0.61; 'content- disposition:inline': 0.62; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'subject:. ': 0.67; 'status:': 0.68; 'subject:This': 0.74; '902': 0.84; 'subject:gets': 0.84; 'str.': 0.91 Date: Mon, 27 May 2013 10:22:29 +1000 From: Cameron Simpson To: =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= Subject: Re: This mail never gets delivered. Any ideas why? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a94ee23-f0f6-470c-a927-0d6bb35a3114@googlegroups.com> User-Agent: Mutt/1.5.21 (2010-09-15) References: <6a94ee23-f0f6-470c-a927-0d6bb35a3114@googlegroups.com> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=BPvrNysG c=1 sm=1 a=wom5GMh1gUkA:10 a=tfKMDS7sHdYA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=oU5zinON0TkA:10 a=pGLkceISAAAA:8 a=Z1aHiN306LwhbAGX6G8A:9 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 a=ChdAjXE5lkUvdteQbhpnkQ==:117 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: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369614175 news.xs4all.nl 15890 [2001:888:2000:d::a6]:46840 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46147 On 26May2013 13:48, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | I'am receiving this now after some tries: | | A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. | | /home/nikos/public_html/cgi-bin/metrites.py in () | 139 else: | 140 sp = subprocess.Popen(['mail', '-f', FROM, '-s', 'Mail from Guest', 'support@superhost.gr'], stdin=subprocess.PIPE) | => 141 sp.communicate( MESSAGE ) | 142 status = sp.wait() | 143 if status: | sp = , sp.communicate = >, MESSAGE = 'kdsjfksdjkfjksdjfs\r\n\t' | /opt/python3/lib/python3.3/subprocess.py in communicate(self=, input='kdsjfksdjkfjksdjfs\r\n\t', timeout=None) | 901 if input: | 902 try: | => 903 self.stdin.write(input) Well, you should probably be writing to sp.stdin, not sys.stdin. | 904 except IOError as e: | 905 if e.errno != errno.EPIPE and e.errno != errno.EINVAL: | self = , self.stdin = <_io.BufferedWriter name=5>, self.stdin.write = , input = 'kdsjfksdjkfjksdjfs\r\n\t' | TypeError: 'str' does not support the buffer interface | args = ("'str' does not support the buffer interface",) | with_traceback = This is symptomatic of sys.stdin (well, whatever you're writing to) being open in binary mode instead of text mode. And you're passing a str. Try passing std.encode(). Cheers, -- Cameron Simpson Yes, [congress is] petty and venal and selfish. That's why they're called _representatives_. - Will Durst