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

I have solved an error "KeyError: 'vardescsearch'". #25

Open
kousuke-nakano opened this issue Apr 29, 2020 · 1 comment
Open

I have solved an error "KeyError: 'vardescsearch'". #25

kousuke-nakano opened this issue Apr 29, 2020 · 1 comment
Assignees

Comments

@kousuke-nakano
Copy link

Dear developers,

I encountered a error when I was making a document:

File "~/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/sphinxfortran/fortran_autodoc.py", line 348, in scan
m = block'vardescsearch'
KeyError: 'vardescsearch'

I have solved the error by changing the following lines in fortran_autodoc.py:

line 348
if line.strip().startswith('!'):
continue
m = block'vardescsearch'
if m:
block['vars'][m.group('varname').lower()]['desc'] = m.group('vardesc')

to
if line.strip().startswith('!'):
continue
if 'vardescsearch' in block:
m = block'vardescsearch'
if m:
block['vars'][m.group('varname').lower()]['desc'] = m.group('vardesc')

Also, in the user manual, I wonder

.. f:autovariable:: modname

instead,

.. f:automodule:: modname

Best regards.

@stefraynaud stefraynaud self-assigned this Apr 30, 2020
@stefraynaud
Copy link
Member

Thanks for your report.
Please, can your make a pull request?

RogierFloors added a commit to RogierFloors/sphinx-fortran that referenced this issue Mar 2, 2022
RogierFloors added a commit to RogierFloors/sphinx-fortran that referenced this issue Mar 2, 2022
stefraynaud pushed a commit that referenced this issue Mar 2, 2022
* Running 2to3 on python files

* Small changes for python3

Also I made an extra check if varsdescsearch is a key
because this can throw an error if it the key is not there
The regex for vardescsearch, because the current one did not
give proper match after variable declaration.

* Corrected bug for if triggered at the last line

In that case the src[iline+1] goes out of bound. So I added an extra
condition that checks that the length is less then len(src)-1.

* Removed unneeded changes compared to v1.1.1

* Fixes issues #25

* Fixes issues #25

Co-authored-by: rofl <[email protected]>
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

2 participants