[SciPy-user] f2py "Segmentation fault", please help
Robert Kern
robert.kern at gmail.com
Wed Jun 11 19:53:48 EDT 2008
On Wed, Jun 11, 2008 at 18:41, Kimberly Artita <kartita at gmail.com> wrote:
> 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 *
> full()
Can you try this without psyco? It might be complicating matters.
> from readin_f90 import *
>
> test_readin()
>
> 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.wtr
> basins.pso basins.eve basins.fig basins.cod basins.bsn
> basins.wwq
> crop.dat till.dat pest.dat fert.dat urban.dat
> 1 1 3 3 3 3 0 0 0
> pcp.pcp
>
>
> tmp.tmp
>
>
>
> I generate the *.so file with: f2py -c -m readin_f90 readin_f90.f90
>
> kimi at localhost ~ $ python readin.py
> Gives this:
> file.cio opened
> Segmentation fault
>
> Here the gdb output:
> kimi at 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
> /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libgfortran.so.2
> (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 ?? ()
> (gdb)
If psyco isn't to blame, then it looks like a problem in gfortran's
libraries. On OS X with gfortran 4.2.0, I don't get a segfault.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-User
mailing list