trouble controlling vim with subprocess on windows machine
Eric_Dexter at msn.com
Eric_Dexter at msn.com
Mon Jul 9 19:30:25 EDT 2007
On Jul 9, 11:06 am, Josiah Carlson <josiah.carl... at sbcglobal.net>
wrote:
> Eric_Dex... at msn.com wrote:
> > I am having trouble contolling vim with subprocess on a windows
> > machine. It appears that vim comes up on the machine all right and it
> > sometimes looks like it is doing the searchs what I am asking it to do
> > but when I am asking it to load a file it doesn't do anything. Is
> > there something I need to do to push the data through the pipe?? Here
> > is a couple different ways I am trying to do it.
>
> [snip]
>
> This recipe for asynchronous communication using subprocess could be
> used to write an expect-like tool:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554
>
> It works on both Windows and *nix.
>
> - Josiah
I had the original dir work but when I tried to trade it out with vim
it isn't clear
how I should call it.. vim filename and it doesn't find filename for
some reason.
I called it pipe and then
inport pipe
def load_instrument3(instr_name, csd_name):
if sys.platform == 'win32':
shell, commands, tail = ('gvim' + csd_name, (csd_name,
csd_name), '\r\n')
else:
shell, commands, tail = ('sh', ('ls', 'echo HELLO WORLD'),
'\n')
a = pipe.Popen(shell, stdin=pipe.PIPE, stdout=pipe.PIPE)
print pipe.recv_some(a),
for cmd in commands:
pipe.send_all(a, csd_name)
print pipe.recv_some(a),
pipe.send_all(a, csd_name)
print pipe.recv_some(a, e=0)
a.wait()
More information about the Python-list
mailing list