Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46147

Re: This mail never gets delivered. Any ideas why?

Date 2013-05-27 10:22 +1000
From Cameron Simpson <cs@zip.com.au>
Subject Re: This mail never gets delivered. Any ideas why?
References <6a94ee23-f0f6-470c-a927-0d6bb35a3114@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2223.1369614175.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 26May2013 13:48, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= <nikos.gr33k@gmail.com> 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 = <subprocess.Popen object>, sp.communicate = <bound method Popen.communicate of <subprocess.Popen object>>, MESSAGE = 'kdsjfksdjkfjksdjfs\r\n\t'
|  /opt/python3/lib/python3.3/subprocess.py in communicate(self=<subprocess.Popen object>, 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 = <subprocess.Popen object>, self.stdin = <_io.BufferedWriter name=5>, self.stdin.write = <built-in method write of _io.BufferedWriter object>, input = 'kdsjfksdjkfjksdjfs\r\n\t'
| TypeError: 'str' does not support the buffer interface 
|       args = ("'str' does not support the buffer interface",) 
|       with_traceback = <built-in method with_traceback of TypeError object>

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 <cs@zip.com.au>

Yes, [congress is] petty and venal and selfish.  That's why they're called
_representatives_.      - Will Durst

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 13:20 -0800
  Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 13:25 -0800
    Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 20:42 -0800
      Re: This mail never gets delivered. Any ideas why? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-10 05:56 +0000
        Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 22:00 -0800
          Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-10 03:19 -0700
          Re: This mail never gets delivered. Any ideas why? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-10 10:37 +0000
            Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-10 11:39 -0700
              Re: This mail never gets delivered. Any ideas why? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-03-11 23:34 +0100
                Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-26 01:49 -0700
                Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-26 03:26 -0700
                Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 13:44 -0700
                Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 13:48 -0700
                Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 14:43 -0700
                Re: This mail never gets delivered. Any ideas why? Cameron Simpson <cs@zip.com.au> - 2013-05-27 10:22 +1000
    Re: This mail never gets delivered. Any ideas why? Michael Torrie <torriem@gmail.com> - 2013-03-09 22:07 -0700
      Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 21:10 -0800
        Re: This mail never gets delivered. Any ideas why? Michael Torrie <torriem@gmail.com> - 2013-03-10 10:09 -0600
          Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-10 10:53 -0700
            Re: This mail never gets delivered. Any ideas why? Michael Torrie <torriem@gmail.com> - 2013-03-10 20:20 -0600
          Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-10 10:53 -0700
      Re: This mail never gets delivered. Any ideas why? Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 21:10 -0800
    Re: This mail never gets delivered. Any ideas why? Chris Angelico <rosuav@gmail.com> - 2013-03-10 09:15 +1100
  Re: This mail never gets delivered. Any ideas why? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-03-11 06:25 +0100
    Re: This mail never gets delivered. Any ideas why? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-03-11 06:47 +0100
      Re: This mail never gets delivered. Any ideas why? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-03-11 06:59 +0100
  Re: This mail never gets delivered. Any ideas why? nagia.retsina@gmail.com - 2013-03-11 02:15 -0700
    Re: This mail never gets delivered. Any ideas why? Benjamin Schollnick <benjamin@schollnick.net> - 2013-03-11 06:44 -0400
    Re: This mail never gets delivered. Any ideas why? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-03-11 17:24 +0100

csiph-web