Skip to content

Fixed Form and AttributeError #50

@Hbethray05

Description

@Hbethray05

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
main()
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/f2py2e.py", line 650, in main
run_main(sys.argv[1:])
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/f2py2e.py", line 408, in run_main
postlist = callcrackfortran(files, options)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/f2py2e.py", line 329, in callcrackfortran
postlist = crackfortran.crackfortran(files)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 3247, in crackfortran
readfortrancode(files, crackline)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 422, in readfortrancode
'this code is in fix form?\n\tline=%s' % repr(l))
Exception: readfortrancode: Found non-(space,digit) char in the first column.
Are you sure that this code is in fix form?
line='xc----------------------------------------------------------------------'

#########################################################################
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
main()
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/f2py2e.py", line 650, in main
run_main(sys.argv[1:])
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/f2py2e.py", line 408, in run_main
postlist = callcrackfortran(files, options)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/f2py2e.py", line 329, in callcrackfortran
postlist = crackfortran.crackfortran(files)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 3247, in crackfortran
readfortrancode(files, crackline)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 511, in readfortrancode
dowithline(finalline)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 782, in crackline
analyzeline(m, pat[1], line)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 1088, in analyzeline
last_name = updatevars(typespec, selector, attr, edecl)
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 1544, in updatevars
el = [x.strip() for x in markoutercomma(entitydecl).split('@,@')]
File "/Users/hyq/anaconda/lib/python3.4/site-packages/numpy/f2py/crackfortran.py", line 822, in markoutercomma
assert not f, repr((f, line, l, cc))
AssertionError: (1, ' daij = (/', ' daij = (/', ')')

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions