-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolver.glob returns IndexError where Resolver.get does not #125
Comments
Good catch. This is a bug. I will fix it. Will be fixed in 1.8.1 |
Great! Just tested with the fix and it works. |
This issue seems to be back in 2.8.0 for the original relative case and when directly referencing the top node. from anytree import Node, Resolver
top = Node("top", parent=None)
sub0 = Node("sub0", parent=top)
r = Resolver('name') For sub0 >>> print(r.get(sub0, '..'))
Node('/top')
>>> print(r.glob(sub0, '..'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python37\lib\site-packages\anytree\resolver.py", line 147, in glob
return self.__glob(node, parts)
File "C:\Program Files\Python37\lib\site-packages\anytree\resolver.py", line 171, in __glob
nodes += self.__glob(node.parent, remainder)
File "C:\Program Files\Python37\lib\site-packages\anytree\resolver.py", line 167, in __glob
name = parts[0]
IndexError: list index out of range Referencing the top level in the glob. >>> print(r.get(top, '/top'))
Node('/top')
>>> print(r.glob(top, '/top'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python37\lib\site-packages\anytree\resolver.py", line 147, in glob
return self.__glob(node, parts)
File "C:\Program Files\Python37\lib\site-packages\anytree\resolver.py", line 167, in __glob
name = parts[0]
IndexError: list index out of range |
It hasn't been released yet. The 1.8.1 above was a typo. |
Will release 3.0.0 soon |
Hey guys, I'm curious if this bug was ever patched. The repo still says it's on version 2.8.0 |
Example:
Getting the top node from
sub0
:Using glob:
The text was updated successfully, but these errors were encountered: