B
bwv549
I'm doing some work with pymol and having trouble getting all the
pymol output out:
# I open it in quiet/commandline mode with a pipe:
IO.popen("pymol -cq -p", 'w+') do |pipe|
pipe.puts "load file.pdb, mymodel\n"
pipe.puts "run my_script.py"
# this command will generate a whole bunch of output to stdout
pipe.puts "my_script mymodel"
sleep(5) # <--- this is what I have to do in order to get the
output
pipe.close_write
output = pipe.read
end
What is annoying is that unless I sleep for 2-5 seconds I don't get
output or (even worse) my output is cut off. There has to be a way
besides arbitrarily sleeping to ensure that the command is finished.
I've tried things like piping in "quit", but that doesn't seem to
work. Anybody know how to solve this? I'm happy to use a different
approach if it means I can be sure I get all of my output out. --
Thanks!
pymol output out:
# I open it in quiet/commandline mode with a pipe:
IO.popen("pymol -cq -p", 'w+') do |pipe|
pipe.puts "load file.pdb, mymodel\n"
pipe.puts "run my_script.py"
# this command will generate a whole bunch of output to stdout
pipe.puts "my_script mymodel"
sleep(5) # <--- this is what I have to do in order to get the
output
pipe.close_write
output = pipe.read
end
What is annoying is that unless I sleep for 2-5 seconds I don't get
output or (even worse) my output is cut off. There has to be a way
besides arbitrarily sleeping to ensure that the command is finished.
I've tried things like piping in "quit", but that doesn't seem to
work. Anybody know how to solve this? I'm happy to use a different
approach if it means I can be sure I get all of my output out. --
Thanks!