[Numpy-discussion] PyGTK breaks fortran extension???

Åsmund Hjulstad asmund.hjulstad@gmail....
Mon Sep 6 04:16:54 CDT 2010


2010/9/3 Pauli Virtanen <pav@iki.fi>
>
> Fri, 03 Sep 2010 08:53:00 +0300, Åsmund Hjulstad wrote:
> > I have a f2py wrapped fortran extension, compiled using gcc-mingw32
> > (v.4.5.0), numpy 1.5, Python 2.7, where I am experiencing the strangest
> > behaviour. It appears that loading pygtk breaks my fortran extension.
>
> Be aware that "import gtk" sets the current locale.
>
> You can reset it with
> "import locale; locale.setlocale(locale.LC_ALL, 'C')".
>
> Depending on the platform, the locale might for example alter how your
> Fortran runtime parses floating point numbers (i.e., whether the decimal
> separator is "," or "."). For instance, in some old versions of gfortran
> this *was* a problem -- changing the C locale would break the Fortran
> runtime, making it stop the program with some obscure assertion.

Thanks for the suggestion, I was not thinking about this at all, but still..
The problem still persists. (I'm running gfortran 4.5.0 on windows
xp.), even after
resetting the locale after the gtk import, like this

import gtk
import locale
locale.setlocale(locale.LC_ALL,'C')
import refprop
ierr,herr = refprop.setup0(2,"METHANE.FLD|ETHANE.FLD","HMX.BNC","DEF")


>
> > The fortran code has initialization code (it calculates reference state
> > for a combination of fluids). The initialization appearantly has some
> > sanity checks, verifying the results. This initialization fails if gtk
> > is loaded first.
>
> How does it fail? Knowing this could help debugging


The specific error message is

[SETREF error 119] convergence failure in calculating reference state for compon
ent #  2:  [SATP error 144] iteration for saturation state did not converge; P =
 0.10133 MPa.


More information about the NumPy-Discussion mailing list