sending vim text through Python filter

BartlebyScrivener rpdooling at gmail.com
Sun Oct 22 16:47:20 EDT 2006


Hello,

I'm sure this is my fault or some Windows snafu. But using gvim 7.0 on
Windows XP, I can't seem to get gvim to successfully filter text
through a Python script. I also use NoteTab and have no problems
running text from NoteTab through the same Python script.

Any vimmers help with this?

I'm sending standard text with the vim command :%!sort.py

The Python script (sort.py) is:

from sys import stdin
input = stdin.read().split('\n')
input.sort()
print '\n'.join(input)

I get:

Traceback (most recent call last):
  File "d:\python\sort.py", line 2, in ?
    input = stdin.read().split('\n')
IOError: [Errno 9] Bad file descriptor

Thanks,

rd




More information about the Python-list mailing list