title: Python - subprocess I/O operation on closed file
body: <p>I have tried with the class below, execute commands in sequence with subporcess module in python2.6. </p>
  
  <pre><code>from subprocess import Popen, PIPE
  
  class BaculaActions():
  
      def __init__(self):
          self.console = Popen(["bconsole"], stdout=PIPE, stderr=PIPE, stdin=PIPE)
  
      def run_job(self, jobname, level):
          run = self.console.communicate("run job=%s level=%s yes" % (jobname, level))
          return(run)
  
      def del_jobid(self, jobid):
          delete = self.console.communicate("delete jobid=%s" % (jobid))
          return(delete)
  </code></pre>
  
  <p>However, if I try the following code, I get the error: 
  ValueError: I / O operation on closed file </p>
  
  <pre><code>from pconsole import BaculaActions
  
  myconsole = BaculaActions()
  
  run = myconsole.run_job("xxxxx-data", "incremental")
  delete = myconsole.del_jobid(25487)
  </code></pre>
  
  <p>Anyone have idea what can be wrong? 
  I thank</p>