UnicodeDecodeError in Notebook Server if Worksheet is set to 'python' instead of 'sage'

asked 2015-03-12 07:02:07 -0500

Petr gravatar image

updated 2015-03-12 07:03:00 -0500

Hello!

I have a worksheet with non-ascii characters in the source code (utf-8 comments). If I have 'sage' selected in the combo-box on top of the worksheet then "Save worksheet to a file" works well. But if I change this to 'python' than calling "Save worksheet to a file" leads to a UnicodeDecodeError:

'ascii' codec can't decode byte 0xd0 in position 6: ordinal not in range(128)
Traceback (most recent call last):
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/sagenb-0.11.4-py2.7.egg/sagenb/flask_version/decorators.py", line 22, in wrapper
    return f(*args, **kwds)
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/sagenb-0.11.4-py2.7.egg/sagenb/flask_version/worksheet.py", line 48, in wrapper
    return f(username, id, **kwds)
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/sagenb-0.11.4-py2.7.egg/sagenb/flask_version/worksheet.py", line 137, in wrapper
    return f(*args, **kwds)
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/sagenb-0.11.4-py2.7.egg/sagenb/flask_version/worksheet.py", line 938, in worksheet_download
    return unconditional_download(worksheet, title)
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/sagenb-0.11.4-py2.7.egg/sagenb/flask_version/worksheet.py", line 950, in unconditional_download
    g.notebook.export_worksheet(worksheet.filename(), filename, title)
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/sagenb-0.11.4-py2.7.egg/sagenb/notebook/notebook.py", line 748, in export_worksheet
    S.export_worksheet(username, id_number, output_filename, title=title)
  File "/home/sage/sage-6.5/local/lib/python2.7/site-packages/sagenb-0.11.4-py2.7.egg/sagenb/storage/filesystem_storage.py", line 491, in export_worksheet
    f.write(old_heading + g.read())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 6: ordinal not in range(128)
edit retag flag offensive close merge delete

Comments

I've opened https://github.com/sagemath/sagenb/is... for this, though note that the sagenb is now in extreme maintenance mode. You may wish to try to convert to a Jupyter worksheet where perhaps this naming issues is resolved.

kcrisman gravatar imagekcrisman ( 2017-04-21 21:17:47 -0500 )edit

Learned about Jupyter for real last evening, bot that problem and some other problems are not present in Jupyter (and Jupiter seems prettier, not sure about the Jupyter's markdown vs Sage's rich text boxes and Jupyter's versioning vs Sage's versioning thought). I think because of Jupyter this question is outdated, and the related github issues may also be closed in order not to draw developers attention and save time. Still thanks :)

Eugene gravatar imageEugene ( 2017-04-22 02:43:01 -0500 )edit