Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Exception does not show which line raised it

Hi there,

I'm new to sage, and made some sage scripts to improve my python scripts' performances. Then I load my script into a sage session, and run a test function.

When I get exception, it shows me the traceback with functions names only, without the instruction that triggered it. For example :

sage: f.runtest()
Generating keys ...
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-3-abdb981a9bdb> in <module>()
----> 1 f.runtest()

<string> in runtest(self)

<string> in KeyGen(self)

/home/hack4u/Download/SageMath/src/sage/rings/rational.pyx in sage.rings.rational.Rational.__mod__ (/home/hack4u/Download/SageMath/src/build/cythonized/sage/rings/rational.c:22716)()
   2541         n = rat.numer() % other
   2542         d = rat.denom() % other
-> 2543         d = d.inverse_mod(other)
   2544         return (n * d) % other

/home/hack4u/Download/SageMath/src/sage/rings/integer.pyx in sage.rings.integer.Integer.inverse_mod (/home/hack4u/Download/SageMath/src/build/cythonized/sage/rings/integer.c:38530)()
   6169         sig_off()
   6170         if r == 0:
-> 6171             raise ZeroDivisionError, "Inverse does not exist."
   6172         return ans

ZeroDivisionError: Inverse does not exist.

And I have no idea which line in KeyGen does trigger that ZeroDivisionError. Any idea ?