Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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 the worksheet then "Save worksheet to a file" works well. But if I change this to 'python' I get 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)

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

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' I get 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)
click to hide/show revision 3
retagged

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

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)