[SciPy-Dev] F2PY: failed to create intent(cache|hide)|optional array-- must have defined dimensions but got (0, )

Pauli Virtanen pav@iki...
Sun Mar 11 10:36:08 CDT 2012


11.03.2012 09:45, Andreas H. kirjoitti:
[clip]
> I'm trying to wrap the Fortran function sphere.f from FITPACK_. However,
> when I try to call the resulting function like this::
> 
>    spherfit_smth(theta,phi,r,w=None,s=None,eps=None)
> 
> I get the following error:
> 
>    ValueError: failed to create intent(cache|hide)|optional array-- must
> have defined dimensions but got (0,)
> 
> Can someone point me to what's wrong? I cannot find my mistake ...

I'd double-check what the routines calc_spherfit_lwrk1/2 return.

Barring that, you can recompile with debug symbols on:

	export CFLAGS="-ggdb"
	export FFLAGS="-ggdb"
	export LDFLAGS="-ggdb"
	python setup.py build

and run your test program in gdb:

	gdb --args python sometest.py
	...
	(gdb) break f2py_rout_XXX_spherfit_smth
	Break on routine not yet loaded: -> yes
	(gdb) run

where XXX should be replaced with the name of the extension module.
And then step through the execution inspecting variable values

	(gdb) next
	(gdb) print lwrk1

Not fun, but gets the job done.

	Pauli



More information about the SciPy-Dev mailing list