[SciPy-user] f2py "Segmentation fault", please help

Kimberly Artita kartita@gmail....
Wed Jun 11 18:41:58 CDT 2008

Here is a dummy fortran/python code which highlights my problem:

My fortran program readin_f90.f90:
subroutine readin

implicit none

character(len=4) :: title(60)

open (2,file="file.cio")
print *, "file.cio opened"
read (2,5100) title
print *, title

5100 format (20a4)

end subroutine

My python code readin.py:
from psyco import *

from readin_f90 import *


My file file.cio:
General Input/Output section (file.cio):           Wed Jul 18 15:50:10 2007
AVSWAT2000 - SWAT interface MDL

   basins.bsb   basins.sbs   basins.rch   basins.rsv   basins.lqo
   basins.pso   basins.eve   basins.fig   basins.cod   basins.bsn
     crop.dat     till.dat     pest.dat     fert.dat    urban.dat
   1   1   3   3   3   3   0   0   0


I generate the *.so file with: f2py -c -m readin_f90 readin_f90.f90

kimi@localhost ~ $ python readin.py
Gives this:
 file.cio opened
Segmentation fault

Here the gdb output:
kimi@localhost ~ $ gdb python

(no debugging symbols found)
(no debugging symbols found)
 file.cio opened

---Type <return> to continue, or q <return> to quit---
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7d2d6c0 (LWP 8055)]
0xb5c14885 in ?? () from
(gdb) backtrace
#0  0xb5c14885 in ?? ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libgfortran.so.2
#1  0xb7e5fff4 in ?? () from /lib/libc.so.6
#2  0x00000000 in ?? ()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080611/24f6ce15/attachment-0001.html 

More information about the SciPy-user mailing list