[IPython-User] Fortran cell magic

Martín Gaitán gaitan@phasety....
Tue Sep 17 11:19:30 CDT 2013


On Tue, Sep 17, 2013 at 1:01 PM, Chao YUE <chaoyuejoy@gmail.com> wrote:

> Dear Martin,
>
> I am following your github instruction and successfully installed the
> fortran magic.
>
> I am having this error when I tried to execute some line of code:
>
> ImportError: /homel/ychao/.cache/ipython/fortran/_fortran_magic_aed467970fab506a0a5170ace559f7a0.so: cannot open shared object file: No such file or directory
>
>
> the code is rather simple:
>
> %%fortran
> INTEGER,PARAMETER  :: r_std = 4
> REAL(r_std),PARAMETER :: so_cond = 1.5396
>   REAL(r_std),PARAMETER :: so_capa = 2.0514e+6
>
> could you give some some hints? GREAT thanks for this contribution.
>
> cheers,
>
> Chao
>


Hi Chao,

Unfortunately I had no time to resume the work on this, but I'll do asap.

However, your problem is that you didn't define any namespace for your
code. f2py convert modules, subroutines or functions. So try wrapping like
this

In [2]:

%%fortran

module a

    INTEGER,PARAMETER  :: r_std = 4

    REAL(r_std),PARAMETER :: so_cond = 1.5396

    REAL(r_std),PARAMETER :: so_capa = 2.0514e+6

end module

In [3]:

a.r_std

Out[3]:

array(4, dtype=int32)

cheers
martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130917/6f0cf8a2/attachment.html 


More information about the IPython-User mailing list