kazoo.recipe.cache.TreeCache doesn't work on Windows because it uses backslash
sr-mlitvin opened this issue · 2 comments
the recipe is using os.path.join which uses backslash on windows.
https://github.com/python-zk/kazoo/blob/master/kazoo/recipe/cache.py#L339
need to use '/'.join() or similar instead
Expected Behavior
TreeCache should load the tree
Actual Behavior
Cannot load any children because uses \ on windows
e.x. tries to get '/presence\tss' instead of '/presence/tss'
Snippet to Reproduce the Problem
Listen to any tree on windows
Logs with logging in DEBUG mode
DEBUG:kazoo.client:Sending request(xid=305): GetChildren(path='/presence\tss', watcher=<bound method TreeNode._process_watch of <kazoo.recipe.cache.TreeNode object at 0x000001FD4BA1E5E0>>)
Specifications
- Kazoo version: 2.6+, but I think it is present in all versions
- Result of
pip list
command: - Zookeeper version: 2.6 on Linux
- Zookeeper configuration: put here any useful ZK configuration (authentication, encryption, number of ZK members, number of (concurrent?) clients, Java version, krb5 version, etc.)
- Python version: 3.8
- OS: Windows
Hi,
Thanks for the issue.
Makes perfect sense. I believe we might have some other issues with Windows, since we have not any testing for this platform.
We can probably take advantage of pathlib to get nice path manipulation semantics by explicitly using the PurePosixPath
type to create the paths as needed.