[Numpy-discussion] [F2PY]: Allocatable Arrays

Pearu Peterson pearu@cens.ioc...
Fri Feb 1 08:49:06 CST 2008

On Fri, February 1, 2008 4:18 pm, Andrea Gavana wrote:
> Hi Lisandro,
> On Feb 1, 2008 1:59 PM, Lisandro Dalcin wrote:
>> Sorry if I'm making noise, my knowledge of fortran is really little,
>> but in your routine AllocateDummy your are fist allocating and next
>> deallocating the arrays. Are you sure you can then access the contents
>> of your arrays after deallocating them?
> Thank you for your answer.
> Unfortunately it seems that it doesn't matter whether I deallocate
> them or not, I still get the compilation warning and I can't access
> those variable in any case.

You cannot access those becase they are deallocated. Try to
disable deallocate statements in your fortran code.

> It seems like f2py (or python or whatever)
> does not like having more than 1 allocatable array inside a MODULE
> declaration.

This is not true.

>> How much complicated is your binary format?
> *Very* complex. The fact is, I already know how to read those files in
> Fortran, is the linking with Python via f2py that is driving me mad. I
> can't believe no one has used before allocatable arrays as outputs
> (whether from a subroutine or from a module).

You can use allocatable arrays from module in Python as described
in f2py users guide.

It could be that the problem is related to deallocating the arrays
in the fortran code.


More information about the Numpy-discussion mailing list