Skip to content

Conversation

nickzoic
Copy link

This has caught me out a few times so I thought I'd make it a PR.

before:

>>> import mappy
>>> a = mappy.Aligner("notafile")
>>> a.seq_names
[]

no exception is thrown and it's not immediately obvious that the filename is incorrect.

after:

>>> import mappy
>>> a = mappy.Aligner("notafile")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "python/mappy.pyx", line 151, in mappy.Aligner.__cinit__
    PyErr_SetFromErrnoWithFilenameObject(OSError, fn_idx_in)
FileNotFoundError: [Errno 2] No such file or directory: 'notafile'

It can also throw PermissionError: [Errno 13] Permission denied: 'unreadablefile' and so on.

@nickzoic nickzoic changed the title Throw an exception if the index file can't be opened (python) Throw an exception if the index file can't be opened Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant