f2py
f2py copied to clipboard
Fixed Form and AttributeError
Hello,
I have never had an issue using f2py to compile my 'helinerd.f' fortran code in the past, but now it seems it will not work. In the past when it worked I wrapped the fortran code for python by inputting this in terminal:
$ f2py helinerd.f -m helinerd -h helinerd.pyf
Then compiled the .pyf to get a .so:
$ f2py -c helinerd.pyf helinerd.f
Used to work like a charm.
Now I get a:
Reading .f2py_f2cmap ...
Successfully applied user defined changes from .f2py_f2cmap
Signature file "./helinerd.pyf" exists!!! Use --overwrite-signature to overwrite.
mba97427:Jorge_Routine hyq$ f2py helinerd.f -m helinerd -h helinerd.pyf
Reading .f2py_f2cmap ...
Successfully applied user defined changes from .f2py_f2cmap
Reading fortran codes...
Reading file 'helinerd.f' (format:fix,strict)
Traceback (most recent call last):
File "/Users/hyq/anaconda/bin/f2py", line 28, in
######################################################################### When I add '! -- f90 --' to the first line to fix for this error the error becomes:
Reading .f2py_f2cmap ...
Successfully applied user defined changes from .f2py_f2cmap
Reading fortran codes...
Reading file 'helinerd.f' (format:free)
Line #4 in helinerd.f:"c linerd Helium Line Ratio Diagnostic Subroutine "
analyzeline: No name/args pattern found for line.
Line #12 in helinerd.f:" subroutine helinerd(hryd,td_swtch,in_Te,in_Ne,ntexp,nexp,"
analyzeline: No name/args pattern found for line.
Traceback (most recent call last):
File "/Users/hyq/anaconda/bin/f2py", line 28, in
This is a bit frustrating because I have never had this issue before until now. I need to recompile because I have changed things in the original helinerd.f code.
Any help would be greatly appreciated, Holly
I have narrowed down the issue. The problem seems to be in def markoutercomma in the script crackfortran.py . It does not know how to handle the '(/' in the first line of this section of the code::
real(rprec), dimension(11), parameter :: dAij = (/
& dAij_319, dAij_389, dAij_447, dAij_471, dAij_492,
& dAij_502, dAij_505, dAij_588, dAij_667, dAij_706,
& dAij_728/)
Ok. I think this is the same issue as 'AssertionError when compiling dcuhre #47'. I missed where he said it was the empty spaces in the array. I only saw that there would be work toward fixing it. I am not sure what empty spaces in the array means, but I will give it a go.
While fixing this issue, note that the PR should be created against https://github.com/numpy/numpy