Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(python) Throw an exception if the index file can't be opened #1195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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