Reading input piped from windows vim

Joined
Jul 22, 2010
Messages
1
Reaction score
0
Hi,

I have a program that works fine on linux, which reads lines from VIM and modifies them before pasting back into the current file. I'm attempting to port this over to a windows XP environment. The program is having trouble with the "input_lines = sys.stdin.readlines()". Here is what the program looks like:

#! C:\python27\python.exe

import sys

## MAIN PROGRAM
def main():
input_lines = sys.stdin.readlines()
for i in input_lines:
print i

if __name__ == "__main__":
main()

#### END

Call it x.py. From VI I would use ":.,.+1!x.py" to run the script, but it just gives me the error "IOError: [Errno 9] Bad file descriptor". Does anyone know how to get around this? Or if it's even possible to do something like this using the windows version of VI.

Many thanks

Barry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top