# ERROR: An unexpected error occurred while tokenizing input

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

sage:1+1 2 sage: expand((1+x)^2) x^2 + 2*x + 1 sage:maxima(console) ;;; 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 http://maxima.sourceforge.net 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) 550 551 # and now call a possibly user-defined print mechanism --> 552 manipulated_val = self.display(arg) 553 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 self.shell.hooks.result_display(arg) 579 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/hooks.py. --> 152 print_obj(IPython.genutils.Term.cout, obj) 153 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` 145 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/sage_object.so 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 ...

Is this a binary install or a source install?

It is a binary install (sage-5.0.1-linux-32bit-ubuntu_12.04_lts-i686-Linux.tar.lzma, from http://www.sagemath.org/download.html)

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?

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.

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).