Resolve long tree string problem on Windows #258 #405
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a problem in which large newick trees fail to load from strings in windows, as described in issue #258. This arises because the existing read_newick code code performs os.path.exists() on a string passed to it. This string may either be a path to a file, or a newick file's contents.
On windows, os.path.exists() fails with very long strings, because very long strings causes stat to fail.
This proposed fix
a) includes a self contained unit test demonstrating the problem
b) traps for the ValueError raised when stat fails, and regards such a failure as evidence that the user has supplied a newick tree content, not a file name.