Thanks Andrey and kcrisman for the replies! On Thursday, February 19, 2015 at 4:05:25 PM UTC-5, Andrey Novoseltsev wrote: > > On Thursday, 19 February 2015 12:17:24 UTC-7, kcrisman wrote: >> >> >>> f.write(old_heading + g.read()) >>> exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte >>> 0xc2 in position 5454: ordinal not in range(128) >>> >>> Any help would be appreciated. >>> >> >> I would recommend looking at what happens when you do them - which >> worksheet seems to trigger this? My guess is there is some unusual >> character, see for instance >> >> http://stackoverflow.com/questions/16508539/unicodedecodeerror-ascii-codec-cant-decode-byte-0xc2 >> or >> http://blog.webforefront.com/archives/2011/02/python_ascii_co.html >> for some details - maybe it even is the same character in question. I >> guess we need to ask this to be written with utf-8 or something. Andrey, >> any suggestions? >> > I thought of that, when I saw the error. There was only one worksheet with a weird name (which I had imported from someone). I tried changing the name, but it did not work.
> > Well, my guess is that there are some worksheet titles with non-Latin > characters. Luis - do you have any? Can you try to download them separately > and in a small group? (Separately meaning a single one into sws file, and a > group means two or more that should be packed into an archive.) I am not > sure where exactly encoding commands should be added, but to start with we > need a reproducible behaviour. > OK, so I went over all worksheets, deleting a bunch I did not need anymore, and then tried each worksheet individually. I found out that I had two worksheets causing the problem, i.e., I could not download them individually or whenever they were in a group. They were both imported, i.e., I saw them somewhere (sorry, can't remember where), liked, downloaded and imported. Both run fine, by the way. One is "Newton's Method". It is short, and I could not spot any weird characters *after I changed its name*. (This is the one that had a strange name, but I think not UTF-8 characters. It had simply things like & and '). Here is its content: {{{id=0| %hide html("<h2>Newton's Method</h2>") html("Here you can experiment with how Newton's Method approximates the zeros of a function.") html("<ul><li>Modify <i>f</i> for the function whose zero you want.</li>") html("<li>Modify <i>Number of steps</i> for the number of steps the method should take (1—5, default 2).</li>") html("<li>Modify <i>x</i><sub>0</sub> for the starting <i>x</i>-value.</li></ul>") html("If 5 steps is not enough, change the starting value to the last approximation.<p>") html("The default setup provides an example using ") html("<i>x</i><sup>3</sup> + 0.4 <i>x</i><sup>2</sup> - 0.51 <i>x</i> - 0.16") html("<br>") var('x') @interact def squeezers(f=input_box(default=x^3+0.4*x^2-0.51*x-0.16), num_approx= slider(1,5,default=2,step_size=1,label="Number of steps"), xstart=input_box( label="<i>x</i><sub>0</sub>",default=2), xm=input_box(label= "<i>x</i><sub>min</sub>",default=0), xM=input_box(label= "<i>x</i><sub>max</sub>",default=2),roundto=input_box(label="Round answers to how many digits? (0: don't round)",default=4)): if (roundto!=0): xprev = round(xstart,roundto) else: xprev = xstart df = diff(f) displayplot = plot(f,xm,xM,rgbcolor='black',thickness=2) #ym = displayplot.ymin() #yM = displayplot.ymax() for each in range(num_approx): if (df(x=xprev) != 0): xnext = -f(x=xprev)/df(x=xprev)+xprev displayplot = displayplot + line([[xprev,0],[xprev,f(x=xprev)]], linestyle='--') displayplot = displayplot + plot(df(x=xprev)*(x-xprev)+f(x=xprev ),xprev,xnext) displayplot = displayplot + point((xnext,0),pointsize=20) xprev = xnext else: displayplot = displayplot + line([[xm,f(x=xprev)],[xM,f(x=xprev )]],linestyle='--') if (df(x=xprev) != 0): if (roundto!=0): html("Approximation is " + (str(round(xprev,roundto)).rstrip('0' ))) else: html("Approximation is " + (str(xprev).rstrip('0'))) displayplot = displayplot + point((xprev,0),pointsize=30,rgbcolor= 'red') else: html("Unable to complete, due to horizontal tangent line.") #displayplot.show(xmin=xm,xmax=xM,ymin=ym,ymax=yM) displayplot.show(xmin=xm,xmax=xM) /// }}} {{{id=1| /// }}} The other is very long is called "Grand Tour" (and at the top has "The Sage Library -- a Grand Tour, June 2009". It is too long for me to search for characters "manually". I can live without them, so I am happy enough, but anyone is interested in finding exactly what went wrong, I'd be glad to help. Thanks for the help! Luis -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.