Skip to content

Incorrect exception handling in utils/spm_docs.py ? #2690

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

Closed
kchawla-pi opened this issue Sep 3, 2018 · 3 comments
Closed

Incorrect exception handling in utils/spm_docs.py ? #2690

kchawla-pi opened this issue Sep 3, 2018 · 3 comments
Milestone

Comments

@kchawla-pi
Copy link
Contributor

In nipype/utils/spm_docs.py, the function _strip_header() has the code:

    try:
        index = doc.index(hdr)
        ...
    except KeyError as e:
        raise_from(IOError('This docstring was not generated by Nipype!\n'), e)

However, doc doesn't seem to be a dict type so KeyError wouldn't apply here.
If hdr is not found in doc, that would raise a ValueError, which is not caught by the code here.

This was the error I got

    index = doc.index(hdr)
ValueError: substring not found

Ubuntu 18

@kchawla-pi kchawla-pi changed the title Incorrect exception handling in spm_docs ? Incorrect exception handling in utils/spm_docs.py ? Sep 3, 2018
@djarecka
Copy link
Collaborator

djarecka commented Sep 3, 2018

@kchawla-pi - yes, doc doesn't seem to be a dict, rather string. Thank you for reporting. Would you like to create a PR to fix it.

@kchawla-pi
Copy link
Contributor Author

Yup, on it.

@effigies
Copy link
Member

Fixed in #2691.

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

No branches or pull requests

3 participants