Reading input piped from windows vim

Discussion in 'Python' started by ashen_shugar, Jul 22, 2010.

  1. ashen_shugar

    ashen_shugar

    Joined:
    Jul 22, 2010
    Messages:
    1
    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
     
    ashen_shugar, Jul 22, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick Useldinger

    reading piped input in Windows

    Patrick Useldinger, Nov 15, 2003, in forum: Python
    Replies:
    4
    Views:
    1,280
    Georgy Pruss
    Nov 16, 2003
  2. tocer
    Replies:
    0
    Views:
    469
    tocer
    Aug 28, 2004
  3. Daniel Folkes

    New to Vim and Vim-Python

    Daniel Folkes, Oct 24, 2007, in forum: Python
    Replies:
    3
    Views:
    542
    projecktzero
    Oct 25, 2007
  4. Guoliang Cao

    vim 6.2 + vim-ruby don't work

    Guoliang Cao, Oct 16, 2003, in forum: Ruby
    Replies:
    1
    Views:
    159
    Brett H. Williams
    Oct 16, 2003
  5. Yuri Shtil

    Reading from piped standard input on w2k

    Yuri Shtil, Jun 30, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    113
    Tad McClellan
    Jun 30, 2003
Loading...

Share This Page