title: "IOError: [Errno 5] Input/output error" when calling python-program from haskell System.Process
body: <p>the following script runs perfectly if I manually run it from terminal. </p>
  
  <pre><code>import sys
  import pygame
  import pygame.mixer
  
  def play(path):
      pygame.mixer.music.load(path)
      pygame.mixer.music.play(-1)
  
  pygame.mixer.pre_init(44100, -16, 2, 2048)
  pygame.init()
  pygame.mixer.init()
  
  while True:
      path = sys.stdin.readline()[0:-1]
      play(path)
  </code></pre>
  
  <p>whenever I type a path it starts playing that file (and stops playing the previous). </p>
  
  <p>but when i call it from this haskell script:</p>
  
  <pre><code>import System.Process
  import GHC.IO.Handle
  
  main = do
      (Just input, _, _, _) &lt;- createProcess (proc "python" ["mplayer.py"])
      hPutStr input "song.mp3\n"
  </code></pre>
  
  <p>I get the following error-message:</p>
  
  <pre><code>Main: user error (Pattern match failure in do expression at     Main.hs:6:9-29)
  gernot@gernot-Aspire-5733Z:~/Dokumente/Projekte/python/music$ Traceback     (most recent call last):
    File "mplayer.py", line 14, in &lt;module&gt;
      path = sys.stdin.readline()[0:-1]
  IOError: [Errno 5] Input/output error
  </code></pre>
  
  <p>I googled the error-message and didn’t find anything useful for either python or haskell. 
  anyway, the error persists if I append some busy-waiting to the haskell-script</p>