tskit
tskit copied to clipboard
Output name of file (if possible) when tskit.load() fails
@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.
Sounds like a good idea, I think it is doable.