Skip to content

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

Open
@hyanwong

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.

Metadata

Metadata

Assignees

Labels

Python APIIssue is about the Python APIenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions