Traceback when starting zk-shell
fsparv opened this issue · 12 comments
guss-mbp:zkshell gus$ git clone https://github.com/rgs1/zk_shell.git
Cloning into 'zk_shell'...
remote: Counting objects: 1409, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 1409 (delta 2), reused 0 (delta 0)
Receiving objects: 100% (1409/1409), 329.28 KiB | 0 bytes/s, done.
Resolving deltas: 100% (960/960), done.
Checking connectivity... done.
guss-mbp:zkshell gus$ cd zk_shell/
guss-mbp:zk_shell gus$ ls
CHANGES.md CONTRIBUTING.md LICENSE MANIFEST.in README.md TODO bin setup.py zk_shell
guss-mbp:zk_shell gus$ cd bin
guss-mbp:bin gus$ ./zk-shell localhost:2181
Traceback (most recent call last):
File "./zk-shell", line 18, in <module>
from zk_shell.cli import CLI
File "../zk_shell/cli.py", line 14, in <module>
from .shell import Shell
File "../zk_shell/shell.py", line 21, in <module>
from kazoo.exceptions import (
ImportError: No module named kazoo.exceptions
Are there setup steps required before running this? System Requirements? or is something missing from the current version. If so, can you tag the last working version for folks to use?
Just realized this dups #2
System info:
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
guss-mbp:bin gus$ uname -a
Darwin guss-mbp.lan 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
(Mac OSX 10.9.5)
Thanks for the report @fsparv! Yeah for running from source you'll need Kazoo, I've updated the README with instructions:
https://github.com/rgs1/zk_shell/blob/master/README.md#installing
Please let me know if that works for you (either running from the source or installing with pip). Thanks!
guss-mbp:zk_shell gus$ pip install zk-shell
-bash: pip: command not found
But...
guss-mbp:zk_shell gus$ sudo python setup.py install
Password:
running install
running bdist_egg
running egg_info
creating zk_shell.egg-info
writing requirements to zk_shell.egg-info/requires.txt
writing zk_shell.egg-info/PKG-INFO
... MANY MORE LINES ...
guss-mbp:zk_shell gus$ bin/zk-shell localhost:2181
Welcome to zk-shell (0.99.04)
(CONNECTING) />
(CONNECTED) />
Just got me running (haven't actually done anything other than connect yet though). Got my clue for this here: https://docs.python.org/2/install/
But I'm not sure I have a working install :(
(CONNECTED) /> cp /configs/SolrCloud json://test.json/ true true
Traceback (most recent call last):
File "bin/zk-shell", line 22, in <module>
CLI()()
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/cli.py", line 151, in __call__
shell.run(intro if first else None)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/xcmd.py", line 249, in run
self.cmdloop()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/xcmd.py", line 142, in wrapper
return func(args[0], params)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/shell.py", line 430, in do_cp
self.copy(params, params.recursive, params.overwrite, params.max_items, False)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/shell.py", line 499, in copy
zk_url = self._zk.zk_url()
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/xclient.py", line 416, in zk_url
return "zk://%s:%d" % self.current_endpoint
TypeError: not all arguments converted during string formatting
More or less every cp command I try gives that trace
peeking at the code (but not knowing python hardly at all) I get the impression this is a separate issue, and the client isn't setting it's own connection URL properly.
@fsparv: yeah, could you add a print() statement inside of xclient#current_endpoint to examine self._connection._socket.getpeername please? I wonder if it's not a tuple somehow. Are you connected to an IPv4 or IPv6 server?
Running this from master (on Linux) works for me:
$ export ZKSHELL_SRC=1; bin/zk-shell localhost
Welcome to zk-shell (0.99.04)
(CONNECTING) />
(CONNECTED) /> create /config-test 'hello'
(CONNECTED) /> cp config-test json://test.json/ true true
Copying took 0.01 secs
(CONNECTED) /> quit
~/src/zk/zk_shell (master) ✔ cat test.json
{
"/": {
"content": "aGVsbG8=",
"acls": [
{
"perms": 31,
"id": {
"scheme": "world",
"id": "anyone"
}
}
]
}
}
I added the print statement and got the following. Mac OSX tends to think in ipv6 by default. I'm guessing the ::1 is what's tripping you up.
(CONNECTED) /> get /config-test
hello
(CONNECTED) /> cp config-test json://test.json/ true true
('::1', 2181, 0, 0)
Traceback (most recent call last):
File "bin/zk-shell", line 22, in <module>
CLI()()
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/cli.py", line 151, in __call__
shell.run(intro if first else None)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/xcmd.py", line 249, in run
self.cmdloop()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/xcmd.py", line 142, in wrapper
return func(args[0], params)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/shell.py", line 430, in do_cp
self.copy(params, params.recursive, params.overwrite, params.max_items, False)
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/shell.py", line 499, in copy
zk_url = self._zk.zk_url()
File "/Library/Python/2.7/site-packages/zk_shell-0.99.04-py2.7.egg/zk_shell/xclient.py", line 417, in zk_url
return "zk://%s:%d" % self.current_endpoint
TypeError: not all arguments converted during string formatting
Ah interesting, that seems to be the issue! When using IPv6, socket#getpeername returns a 4-tuple:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect(('::1', 631))
s.getpeername() -> ('::1', 631, 0, 0)
Can you pull from master and try again? I've pushed 0f62e8b - thx!
works :)
Great, thanks for testing! I'll do a release later today with the fix