Re: [f2py] passing var values

Pearu Peterson <[email protected]> Wed, 28 Jul 2010 15:24:20 +0300
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
On Wed, Jul 28, 2010 at 2:33 PM, Benjamin Kutz
<[email protected]> wrote:
> Hi,
>
> I've got a problem with passing values of variables from Fortran to Python.
> I've wrapped a Fortran Routine and pass a variable as a Parameter. I
> change the variable in Fortran and want, that Python knows the new value
> of the variable.
>
> My code looks like:
>
>  >>>variable=0
>  >>>fortranmodule.sub(variable)
> #in Fortran the value of the variable is changed to 1

Try:

variable = fortranmodule.sub(variable)

Pearu

>  >>>print 'var',variable
> var 0
> #should be var  1
>
> How can I realize, that I receive the correct value of the variable?
>
> My file wrapp.pyf looks like:
>
>            subroutine sub(variable)
>                 integer intent(in,out) :: variable
>             end subroutine sub
>
> Maybe some one of you can give me some advise.
> Thank you very much!
>
> Greetings
> Ben
>
> _______________________________________________
> f2py-users mailing list
> f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
> http://cens.ioc.ee/mailman/listinfo/f2py-users
>