[Numpy-discussion] f2py problems

George Nurser agn at noc.soton.ac.uk
Tue Jan 24 08:06:04 CST 2006


I'm not sure whether this is the right list for f2py questions, but  
anyway.

Tried it (v 2_1967) out today. It worked beautifully for a simple  
function.

But for a more complicated (f77) *.F file with preprocessor  
directives and a lot of data statements I have been having problems.

Firstly, it just seemed to ignore all of the lines with preprocessor  
directives.



Secondly, after I used a preprocessor to create the .f file  
separately, and then ran the .f file through f2py, I got the  
following error trace.
Anybody have any ideas?

--George Nurser.

f2py -c --verbose -m state2sig state2sig.f
running build
running config_fc
running build_src
building extension "state2sig" sources
f2py options: []
f2py:> /tmp/tmppzKlnT/src/state2sigmodule.c
creating /tmp/tmppzKlnT
creating /tmp/tmppzKlnT/src
Reading fortran codes...
         Reading file 'state2sig.f' (format:fix,strict)
Post-processing...
         Block: state2sig
                         Block: state2sig
Traceback (most recent call last):
   File "/data/jrd/mod1/agn/ext/Linux/bin/f2py", line 6, in ?
     f2py.main()
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
f2py2e.py", line 546, in main
     run_compile()
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
f2py2e.py", line 533, in run_compile
     setup(ext_modules = [ext])
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/distutils/ 
core.py", line 93, in setup
     return old_setup(**new_attr)
   File "/usr/lib64/python2.3/distutils/core.py", line 149, in setup
     dist.run_commands()
   File "/usr/lib64/python2.3/distutils/dist.py", line 907, in  
run_commands
     self.run_command(cmd)
   File "/usr/lib64/python2.3/distutils/dist.py", line 927, in  
run_command
     cmd_obj.run()
   File "/usr/lib64/python2.3/distutils/command/build.py", line 107,  
in run
     self.run_command(cmd_name)
   File "/usr/lib64/python2.3/distutils/cmd.py", line 333, in  
run_command
     self.distribution.run_command(command)
   File "/usr/lib64/python2.3/distutils/dist.py", line 927, in  
run_command
     cmd_obj.run()
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/distutils/ 
command/build_src.py", line 86, in run
     self.build_sources()
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/distutils/ 
command/build_src.py", line 99, in build_sources
     self.build_extension_sources(ext)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/distutils/ 
command/build_src.py", line 149, in build_extension_sources
     sources = self.f2py_sources(sources, ext)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/distutils/ 
command/build_src.py", line 355, in f2py_sources
     f2py2e.run_main(f2py_options + ['--lower',
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
f2py2e.py", line 330, in run_main
     postlist=callcrackfortran(files,options)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
f2py2e.py", line 269, in callcrackfortran
     postlist=crackfortran.crackfortran(files)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 2574, in crackfortran
     postlist=postcrack(grouplist[0])
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 1488, in postcrack
     g=postcrack(g,tab=tab+'\t')
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 1506, in postcrack
     block['body']=analyzebody(block,args,tab=tab)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 1648, in analyzebody
     b=postcrack(b,as,tab=tab+'\t')
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 1506, in postcrack
     block['body']=analyzebody(block,args,tab=tab)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 1648, in analyzebody
     b=postcrack(b,as,tab=tab+'\t')
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 1502, in postcrack
     block['vars']=analyzevars(block)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/numpy/f2py/ 
crackfortran.py", line 2007, in analyzevars
     for k in implicitrules[ln0].keys():
KeyError: '('






More information about the Numpy-discussion mailing list