tskit icon indicating copy to clipboard operation
tskit copied to clipboard

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

Open hyanwong opened this issue 3 years ago • 1 comments

@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.

hyanwong avatar Aug 22 '22 16:08 hyanwong

Sounds like a good idea, I think it is doable.

benjeffery avatar Aug 23 '22 14:08 benjeffery