Unable to find solution to error: ValueError: math domain error

Martin v. Löwis martin at v.loewis.de
Wed Jan 22 11:33:06 CET 2003


"Mark Cooke" <mcooke at technology.serco.com> writes:

> can someone, maybe a developer please explain what could be causing the
> error and
> (in plain exnglish ;), what the error means),as I'm just starting the learn
> python and I know someof the basics.

It is easy to explain what the error means: a mathematical function
gets an argument for which it is not defined. This happens, for
example, if you take the square root of a negative number.

Now, the question is why this is happening, as the only function calls
are math.exp(-0.5) and math.sqrt(2.0), which should not give domain
errors.

If you still get a domain error, it means there is a bug
somewhere. The bug could be in Mailman, in Python, the C library, the
C compiler, the operating system kernel, or the microprocessor.

As a starting point, you should try to see whether this happens
outside mailman as well. In an interactive interpreter, perform

from math import log as _log, exp as _exp, pi as _pi, e as _e
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0)

If this still happens, try to find out which of the subexpressions is
causing the exception. Then analyse the problem with a C debugger
(this probably requires recompilation of Python).

If this doesn't happen stand-alone , try to find out what inside
mailman is causing it:
- don't run it as user mailman
- don't run it with -S
- see whether environment variables affect the behaviour

Kind regards,
Martin




More information about the Python-list mailing list