[MATRIX-SIG] Seg fault in netcdfmodule

Konrad Hinsen hinsen@ibs.ibs.fr
Thu, 29 Jan 1998 15:13:05 +0100

> I'm having problems with segmentation faults when using
> netCDFmodule.c and/or ncmodule.c with Python-1.5 under
> solaris 2.6.  The problem arises when trying to read values
> from the variables as in:
> >>> import netcdf
> >>> fh = netcdf.NetCDFFile('test.nc')
> >>> v = fh.variables['cosx']
> >>> v[0]
> => segmentation fault

There are some problems in the netcdf module that cause crashes
on machines where malloc(0) returns NULL, but only when accessing
scalar variables (i.e. no dimensions). That doesn't seem to be
your case, however.

> I suspect the gcc (2.7.2) compiler.  A recent OS upgrade (2.5.1 to 2.6)
> required a recompile
> of gcc, then a recompile of Python-1.5, NumPy (the EZ Hinsen version),
> and the

If you use my modified NumPy, you must also use a version of the netCDF
module that was released later. You can recognize newer versions
by the "import_array" statement in the init function at the end
of the module. If you use an older version of the module, it will
crash as soon as it uses any NumPy functions. That could very well
be the problem you have!
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-
Institut de Biologie Structurale       | Fax:  +33-
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org