ERROR: An unexpected error occurred while tokenizing input

asked 2012-06-25 04:31:30 +0200

jakubi gravatar image

updated 2012-06-26 22:24:00 +0200

Just installed Sage 5.0.1 on Ubuntu 12.04 32-bit. Simple test operations work fine:

sage: expand((1+x)^2)
x^2 + 2*x + 1
;;; Loading #P"/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/ecl/sb-bsd-sockets.fas"
;;; Loading #P"/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/ecl/sockets.fas"
;;; Loading #P"/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/ecl/defsystem.fas"
;;; Loading #P"/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/ecl/cmp.fas"
Maxima 5.26.0
using Lisp ECL 11.1.1

But errors occur with any plot command that I have tried. See below. What do they mean?

PD. By the way, I have just tried plotting from this Maxima console called by Sage, i.e. something like:

(%i2) plot2d(sin(x),[x,0,1]);

and it works fine, producing the plot through Gnuplot. What is a bit paradoxical...


| Sage Version 5.0.1, Release Date: 2012-06-10                       |
| Type notebook() for the GUI, and license() for information.        |
sage: plot(x,0,1)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (2097, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (273, 0))

ImportError                               Traceback (most recent call last)

/home/jakubi/<ipython console=""> in <module>()

/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/python2.7/site-packages/IPython/Prompts.pyc in __call__(self, arg)
    551             # and now call a possibly user-defined print mechanism
--> 552             manipulated_val = self.display(arg)
    554             # user display hooks can change the variable to be stored in

/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/python2.7/site-packages/IPython/Prompts.pyc in _display(self, arg)
    576             return IPython.generics.result_display(arg)
    577         except TryNext:            
--> 578             return
    580     # Assign the default display method:

/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/python2.7/site-packages/IPython/hooks.pyc in __call__(self, *args, **kw)
    139             #print "prio",prio,"cmd",cmd #dbg
    140             try:
--> 141                 ret = cmd(*args, **kw)
    142                 return ret
    143             except ipapi.TryNext, exc:

/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/python2.7/site-packages/sage/misc/displayhook.pyc in result_display(ip_self, obj)
    150     # IPython's default result_display() uses the IPython.genutils.Term.cout stream.
    151     # See also local/lib/python2.6/site-packages/IPython/
--> 152     print_obj(IPython.genutils.Term.cout, obj)
    154 def displayhook(obj):

/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/python2.7/site-packages/sage/misc/displayhook.pyc in print_obj(out_stream, obj)
    142             if _check_tall_list_and_print(out_stream, obj):
    143                 return
--> 144     print >>out_stream, `obj`
    146 def result_display(ip_self, obj):

/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/python2.7/site-packages/sage/structure/ in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1496)()

/opt/sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux/local/lib/python2.7/site-packages/sage/plot/graphics.pyc in _repr_(self)
    801         """
    802         if SHOW_DEFAULT:
--> 803             self ...
edit retag flag offensive close merge delete


Is this a binary install or a source install?

benjaminfjones gravatar imagebenjaminfjones ( 2012-06-26 22:37:07 +0200 )edit

It is a binary install (sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux.tar.lzma, from

jakubi gravatar imagejakubi ( 2012-06-26 23:46:46 +0200 )edit

As I have not received any useful information so far, I have tried with a couple of previous versions of Sage that I had saved as a backup from an older machine. These are 3.2.3 for Debian 4,0 and 4.7.1 for Ubuntu 10.04. It happens that (simple) plot tests did worked for them, both for the console and the notebook. Then, tried again with ver. 5.0.1 and this time the plots worked. Clearly a rational explanation is missing. A by product is that the .sage directory and possibly other configuration items became somewhat upset, and some oddities are observable. Do I open a new thread for these and related issues?

jakubi gravatar imagejakubi ( 2012-06-29 03:24:31 +0200 )edit

If you have an old `.sage` directory you should try moving it out of the way (to `.sage-old` or something). When sage-5.0.1 starts up it will create a new clean one. Try that and see if your plots work.

benjaminfjones gravatar imagebenjaminfjones ( 2012-06-29 13:36:33 +0200 )edit

No, it is the other way. The .sage directory was originally "new" and 'clean", i.e. created by Sage 5.0.1. And the reported errors occurred with it. Later, the previous versions, when executed, added their stuff to this directory. And whatever they did, the result is that now plots work in Sage 5.0.1 (as well as in the previous versions).

jakubi gravatar imagejakubi ( 2012-06-29 23:18:48 +0200 )edit