Skip to content
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

AttributeError: 'NoneType' object has no attribute 'traverse_tree' #21

Closed
colejensen opened this issue Sep 21, 2020 · 2 comments
Closed

Comments

@colejensen
Copy link

colejensen commented Sep 21, 2020

I'm trying to use the ".traverse_tree" option on an imported .json file. When I use traverse_tree, I get an error saying, "AttributeError: 'NoneType' object has no attribute 'traverse_tree'."

A colleague of mine doesn't get this error using the same code, but they use version 0.1.0. I have gotten it with version 0.1.1 and 0.1.2. When I tried to revert to version 0.1.0, I get the following error: "FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'".

You can see a copy of the code I'm running here.

@evogytis
Copy link
Owner

Hi Cole,

I believe this will be caused by the fact that .subtree() will return None if the conditional traversal doesn't encounter any tips. This can happen if you initiate a traversal on a node in state B but all of the node's children are in another state and since there's no tips in the conditional subtree there's no subtree to be extracted. I think I had the code set up correctly for Ebola exploded trees but didn't bother for flu B because I knew all the traversals would be fine. You can test if this is the case by traversing the subtree with the same condition (should be ll.traverse_tree(k, traverse_condition=traverse_condition, reset_branches=False)) and seeing if any tips are returned.

Thanks for spotting this!

Best,
Gytis

@colejensen
Copy link
Author

This was it! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants