On Jan 27, 2008 6:01 AM, Jaap Spies <[EMAIL PROTECTED]> wrote:
>
> William Stein wrote:
> > On Jan 27, 2008 4:55 AM, Jaap Spies <[EMAIL PROTECTED]> wrote:
> >> William Stein wrote:
> >> [...]
> >>> Could you try changing that line 150 of sage/interfaces/sage0.py to
> >>>           return eval(self.eval('cputime(%s)'%t).strip())
> >>> then do "sage -br" and retry the test and see if it works on your machine?
> >>> Let me know.
> >>>
> >
> > OK, try
> >
> > return float(self.eval('cputime(%s)'%t))
> >
>
> sage:
> Exiting SAGE (CPU time 0m0.00s, Wall time 0m6.15s).
> [EMAIL PROTECTED] sage-2.10.1.rc0]$ ./sage -t  
> devel/sage-main/sage/interfaces/sage0.py 2>&1 | tee -a test_sage0.log
> sage -t  devel/sage-main/sage/interfaces/sage0.py           
> **********************************************************************
> File "sage0.py", line 143:
>      sage: _= sage0.cputime()     # random output
> Exception raised:
>      Traceback (most recent call last):
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/doctest.py", line 
> 1212, in __run
>          compileflags, 1) in test.globs
>        File "<doctest __main__.example_2[0]>", line 1, in <module>
>          _= sage0.cputime()     # random output###line 143:
>      sage: _= sage0.cputime()     # random output
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/site-packages/sage/interfaces/sage0.py",
>  line 150, in cputime
>          return float(self.eval('cputime(%s)'%t))
>      ValueError: invalid literal for float():  1.7937259999999999
>
> **********************************************************************
> File "sage0.py", line 147:
>      sage: _= sage0.cputime()     # random output
> Exception raised:
>      Traceback (most recent call last):
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/doctest.py", line 
> 1212, in __run
>          compileflags, 1) in test.globs
>        File "<doctest __main__.example_2[2]>", line 1, in <module>
>          _= sage0.cputime()     # random output###line 147:
>      sage: _= sage0.cputime()     # random output
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/site-packages/sage/interfaces/sage0.py",
>  line 150, in cputime
>          return float(self.eval('cputime(%s)'%t))
>      ValueError: invalid literal for float():  2.3326449999999999
>
> **********************************************************************
> 1 items had failures:
>     2 of   3 in __main__.example_2
> ***Test Failed*** 2 failures.
> For whitespace errors, see the file .doctest_sage0.py
>           [9.8 s]
> exit code: 256
>
> ----------------------------------------------------------------------
> The following tests failed:
>
>
>          sage -t  devel/sage-main/sage/interfaces/sage0.py
> Total time for all tests: 9.8 seconds
> [EMAIL PROTECTED] sage-2.10.1.rc0]$
>
>
> > and if that doesn't work
> >
> >
> > return float(self.eval('cputime(%s)'%t).strip())
> >
>
> sage:
> Exiting SAGE (CPU time 0m0.01s, Wall time 0m6.39s).
> [EMAIL PROTECTED] sage-2.10.1.rc0]$ ./sage -t  
> devel/sage-main/sage/interfaces/sage0.py 2>&1 | tee -a test_sage0.log
> sage -t  devel/sage-main/sage/interfaces/sage0.py           
> **********************************************************************
> File "sage0.py", line 143:
>      sage: _= sage0.cputime()     # random output
> Exception raised:
>      Traceback (most recent call last):
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/doctest.py", line 
> 1212, in __run
>          compileflags, 1) in test.globs
>        File "<doctest __main__.example_2[0]>", line 1, in <module>
>          _= sage0.cputime()     # random output###line 143:
>      sage: _= sage0.cputime()     # random output
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/site-packages/sage/interfaces/sage0.py",
>  line 150, in cputime
>          return float(self.eval('cputime(%s)'%t).strip())
>      ValueError: invalid literal for float():  1.8237209999999999
> **********************************************************************
> File "sage0.py", line 147:
>      sage: _= sage0.cputime()     # random output
> Exception raised:
>      Traceback (most recent call last):
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/doctest.py", line 
> 1212, in __run
>          compileflags, 1) in test.globs
>        File "<doctest __main__.example_2[2]>", line 1, in <module>
>          _= sage0.cputime()     # random output###line 147:
>      sage: _= sage0.cputime()     # random output
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/site-packages/sage/interfaces/sage0.py",
>  line 150, in cputime
>          return float(self.eval('cputime(%s)'%t).strip())
>      ValueError: invalid literal for float():  2.3896350000000002
> **********************************************************************
> 1 items had failures:
>     2 of   3 in __main__.example_2
> ***Test Failed*** 2 failures.
> For whitespace errors, see the file .doctest_sage0.py
>           [9.3 s]
> exit code: 256
>
> ----------------------------------------------------------------------
> The following tests failed:
>
>
>          sage -t  devel/sage-main/sage/interfaces/sage0.py
> Total time for all tests: 9.3 seconds
>
> > I have to say -- I just don't get why this doesn't work on your FC7 machine.
> > All that it is doing is eval'ing a correct float constant...  I wonder if 
> > there
> > are weird hidden invisible control codes in the output or something.
> >
>
> This is from the log file:
>      ValueError: invalid literal for float(): ^[[0;31m ^[[0m1.8237209999999999
> **********************************************************************
> File "sage0.py", line 147:
>      sage: _= sage0.cputime()     # random output
> Exception raised:
>      Traceback (most recent call last):
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/doctest.py", line 
> 1212, in __run
>          compileflags, 1) in test.globs
>        File "<doctest __main__.example_2[2]>", line 1, in <module>
>          _= sage0.cputime()     # random output###line 147:
>      sage: _= sage0.cputime()     # random output
>        File 
> "/home/jaap/downloads/sage-2.10.1.rc0/local/lib/python2.5/site-packages/sage/interfaces/sage0.py",
>  line 150, in cputime
>          return float(self.eval('cputime(%s)'%t).strip())
>      ValueError: invalid literal for float(): ^[[0;31m ^[[0m2.3896350000000002
> **********************************************************************
> 1 items had failures:
>     2 of   3 in __main__.example_2
> ***Test Failed*** 2 failures.
> For whitespace errors, see the file .doctest_sage0.py
>           [9.3 s]
> exit code: 256
>
> Seems you are right!

Bummer.  OK, following http://www.thescripts.com/forum/thread167794.html could
you try replacing return float(self.eval('cputime(%s)'%t)) by

aString = self.eval('cputime(%s)'%t)
IDENTITY_MAP = ''.join([chr(x) for x in range(256)])
BAD_MAP = ''.join([chr(x) for x in range(32) + [124])
aNewString = aString.translate(IDENTITY_MAP, BAD_MAP)
return float(aNewString)

and let me know what happens.  If this works, it will at least make it
clear how we can fix the problem... I guess.

I wonder if the notebook works kind of funky for you on that
same computer?  I mean, if there are funny control codes everywhere
in sage0, then that would impact the notebook as well, possibly.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to