[f2py] Segmentation fault for format write

Stiaan Gerber 14527839 at sun.ac.za
Thu Oct 8 12:11:18 EEST 2009


Hi there, I have also been struggling with this problem for months. I
can't get formatted write statements to work. I have no problems with
statements like
write(44,*) or
write(*,*)

However statements like
write(*,"(I3)") x
or
write (44,144) x, y
144 format(2f20.15)
results in a segfault.

When I compile with gfortran and run, everything is fine. Commenting out
write statements and using f2py also works fine. (except that I don't
get my files generated the way I want)
Any help would be greatly appreciated.

Stiaan


>    Formatted output with the 'write' command should work. With both
strings and numbers. Try to define the number of string digits, e.g., A20.
>   
>    bw, Johanna Torppa
>   
>    -----Original Message-----
>    From: f2py-users-bounces at cens.ioc.ee [mailto:f2py-users-bounces
at cens.ioc.ee] On Behalf Of Shang-Jun Ye
>    Sent: 16. syyskuuta 2009 13:52
>    To: f2py-users at cens.ioc.ee
>    Subject: [f2py] Segmentation fault for format write
>   
>    Hi,
>    I try to integrate a Fortran output subroutine by Python, the f2py
>    runs successfully, however, when I run the script, I have got a
>    Segmentation fault without any more infomation. does f2py support
>    format write?
>    here is my Fortran subroutine :
>    ! output.f95
>    subroutine output
>    implicit none
>     write(*,'(1x,a)') 'write something'
>    !write(*,*)'write something' !works well
>   
>    end subroutine output
>   
>    the corresponding python script is
>    import output
>    output.output()
>    ! >>>Segmentation fault



More information about the f2py-users mailing list