Skip to content

Output name of file (if possible) when tskit.load() fails #2467

Description

@hyanwong

@savitakartik had an issue that she had an array of filenames of tree sequences, and was trying to load them using tskit.load. A bug in her script meant that some of the files weren't tree sequences, but e.g. python scripts. She got the error message

FileFormatError: File not in kastore format....

It took a while to realise the bug. It would have been obvious if the error message had printed out the filename too, e.g.

FileFormatError: File `my_script.py` not in kastore format....

Obviously not possibly is e.g. loading from a stream, but if the ts is a file on disk, this would be useful info in the error output, I think.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Python APIIssue is about the Python APIenhancementNew feature or requestfutureIssues that are closed as they are not planned in the medium-term, but which are still desirable.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions