Is IO.popen supposed to be working OK?

I'm getting errors with


  PYTHON = "C:/cygwin/usr/bin/python"
  PYTHON_PROG = "-../AnnaAIML-.7.0/anna_brain/skel.py"
  MODE = "w+"
  PAUSE = 30

  def setup_program
    if block_given?
      Open3.popen3(PYTHON_PROG, MODE) do |io|
        sleep PAUSE
        ignore = io.read
        yield io
      end
    else
      @io =  IO.popen(PYTHON_PROG, MODE)   #<----- Errors here
      # ignore = @io.read
    end
  end

with either No such file or directory" if the - is at the start, 
or exec format error if it points to the python script with a 
#!python
line.  Yes, I'm trying to use ruby's interpretation of the #! line
to spin off a python program.    So why it is treating this as a
file path spec rather than a command string?  The ri docs talk
about it being a command string.  If I put a path
to the Python in there using #{PYTHON} it can't find the file with a 
space: "#{PYTHON} ../"...

So I've tried:

  PYTHON_PROG = "-../AnnaAIML-.7.0/anna_brain/skel.py"
  PYTHON_PROG = "../AnnaAIML-.7.0/anna_brain/skel.py"
  PYTHON_PROG = "#{PYTHON} ../AnnaAIML-.7.0/anna_brain/skel.py"

all without success.

This is not mission critical for me, I'm just messing about with PyAIML
and Shoes, but I'd like to know why my assumptions about popen and popen3
are bonkers.  I'd use expect.rb 
http://www.ruby-doc.org/stdlib/libdoc/pty/rdoc/index.html
but I'm fairly sure that won't work on Windows.

        Hugh

Reply via email to