Problem with the ipy.vim script
I'm trying to use the ipy.vim script to set up a small python dev environment, but I'm running into a connection problem. When I type ipy_vimserver.setup("demo") I get this error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/usr/lib/pymodules/python2.6/IPython/Extensions/ipy_vimserver.py", line 109, in ser开发者_如何学编程ve_me
self.listen()
File "/usr/lib/pymodules/python2.6/IPython/Extensions/ipy_vimserver.py", line 93, in listen
self.socket.bind(self.__sname)
File "<string>", line 1, in bind
error: [Errno 98] Address already in use
When I type it a second time, everything is fine but when I launch gvim the F4/F5 command do nothing and state that they can't connect to the Ipython server.
any suggestion?
Problem:
Look at the last line of the stack trace: error: [Errno 98] Address already in use
Explanation:
A nice explanation of "Address already in use"
error can be found here: "Bind: Address Already in Use"
Possible Solution:
As I have not tried ipy.vim
setup myself, from networking point of view, a quick suggestion would be to:
- close/kill both the server (
ipython server
) and the client (vim running ipy.vim
). - Restart
ipython server
- Run vim with
ipy.vim
and try to debug.
Additional Info:
- On Linux/Unix machines, the timeout values are defined in
/proc/sys/net/ipv4/tcp_keepalive_time
and/proc/sys/net/ipv4/tcp_fin_time
- On Windows machines, this is set in
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpTimedWaitDelay
. More details is here: TcpTimedWaitDelay
If I run the exact same code I get the same error. If I change the name from "demo" to, for example, "cookies" it works. Hmm....
This happens when there's already a socket with the name you're trying to create, in this case 'demo'. You need to delete it before doing the ipy_vimserver.setup - in your case, the socket file to delete is ~/.ipython/demo
(I'm one of the authors of ipy.vim)
精彩评论