How does vim.py from python-vim.sourceforge.net work?

Phlip phlip_cpp at yahoo.com
Fri May 3 14:01:29 EDT 2002


Hypo Nt:

I'm attempting to perform the Refactor "Replace Documentary Comment With 
Test" on vim.py, and I have gotten this far:
 
if __name__ == '__main__':
 
# How to use this module: First, make a commWindow. Then, use the commwindow 
to
# find a server. Then send your commands to the servers - but check to see if
# it is still valid or not. It will throw exceptions if the window is no 
longer
# valid.
        
        dpy = display.Display()
        aComWin = commWindow(dpy)
        aComWin.lookup_name('name')
 
I'm at the step "find a server", which may imply 'lookup_name', but it sez 
None when I run it, on this line:
 
   File "vim.py", line 178, in ?
     aComWin.lookup_name('name')
   File "vim.py", line 50, in lookup_name
     names = self.get_names()
   File "vim.py", line 92, in get_names
     r = result.value.split("\0")
 AttributeError: 'NoneType' object has no attribute 'value'     
 
(I nudged the line numbers a little.) Apparently this line fails:
 
        # Get the global properties
         result = self.screen.root.get_property(
             self.registryProperty, X.AnyPropertyType, 0, 100000
         )
 
It fails whether or not a gvim or vim is in the 'puter.
 
That's with python-xlib-0.12. So I switch back to python-xlib-0.9 - the one 
available a few days before your latest version on Fri 7 Dec 2001.
 
That produces a revolting obsolete code error:
 
   File "vim.py", line 176, in ?
     dpy = display.Display()
   ...
   File "/usr/lib/python2.2/site-packages/Xlib/support/unix_connect.py", line 
 68, in get_socket
     fcntl.fcntl(s.fileno(), FCNTL.F_SETFD, FCNTL.FD_CLOEXEC)
 AttributeError: 'module' object has no attribute 'FD_CLOEXEC'
 
This error is before the other one, leaving me little confidence that if I 
just band-aid it the other one will start working.
 
I will noodle around with the code and if I find something I'l post it here. 
But does anyone have any tips?
 
I like totally need this functionality at work because I'm building a better 
test rig than PyUnit, and they all use gvim.
 
-- 
  Phlip
   http://www.greencheese.org/PhilosophyBrethrenThree
  --  To catch a bug, you'v got to learn to think like a bug  --



More information about the Python-list mailing list