Opened 11 years ago

Closed 3 years ago

#9711 closed defect (worksforme)

sagenb notebook -- error when downloading worksheets in some cases involving non-ASCII characters

Reported by: was Owned by: jason, was
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: notebook Keywords:
Cc: ppurka, jason, kini Merged in:
Authors: Tim Dumol Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

I hope this traceback from the serverlog on prep.sagenb.org will help me to debug and fix this:

2010-08-09 14:11:02-0700 [-] Exception rendering:
2010-08-09 14:11:02-0700 [-] Unhandled Error
        Traceback (most recent call last):          File "/usr/local/sage-prep/local/lib/python/threading.py", line 497, in __bootstrap
            self.__bootstrap_inner()
          File "/usr/local/sage-prep/local/lib/python/threading.py", line 525, in __bootstrap_inner            self.run()
          File "/usr/local/sage-prep/local/lib/python/threading.py", line 477, in run
            self.__target(*self.__args, **self.__kwargs)
        --- <exception caught here> ---
          File "/usr/local/sage-prep/local/lib/python2.6/site-packages/twisted/python/threadpool.py", line 210, in _worker
            result = context.call(ctx, function, *args, **kwargs)
          File "/usr/local/sage-prep/local/lib/python2.6/site-packages/twisted/python/context.py", line 59, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/usr/local/sage-prep/local/lib/python2.6/site-packages/twisted/python/context.py", line 37, in callWithContext
            return func(*args,**kw)
          File "/usr/local/sage-prep/sagenb-0.8.p2/src/sagenb/sagenb/notebook/twist.py", line 1448, in f
            notebook.export_worksheet(worksheet.filename(), sws_filename)
          File "/usr/local/sage-prep/sagenb-0.8.p2/src/sagenb/sagenb/notebook/notebook.py", line 983, in export_work
sheet
            S.export_worksheet(username, id_number, output_filename, title=title)
          File "/usr/local/sage-prep/sagenb-0.8.p2/src/sagenb/sagenb/storage/filesystem_storage.py", line 362, in ex
port_worksheet
            open(worksheet_txt,'w').write(old_heading + open(worksheet_html).read())
        exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 180: ordinal not in range(12
8)

Attachments (2)

trac_9711-unicode-worksheets.patch (1014 bytes) - added by timdumol 11 years ago.
Wraps the arguments of the write call in an encoded_str() call.
testdoc3.sws (96.0 KB) - added by chapoton 4 years ago.

Download all attachments as: .zip

Change History (9)

Changed 11 years ago by timdumol

Wraps the arguments of the write call in an encoded_str() call.

comment:1 Changed 11 years ago by timdumol

  • Status changed from new to needs_review

I have been unable to replicate the issue, even with rather exotic unicode characters (in the title and the body), but this should fix any possible problems (hopefully).

comment:2 Changed 9 years ago by jdemeyer

Please fill in your real name as Author.

comment:3 Changed 9 years ago by timdumol

  • Authors set to Tim Dumol

I think this should be closed. Codec related issues should be long gone, especially with the internationalization changes that have occurred since this.

comment:4 Changed 8 years ago by kcrisman

  • Cc ppurka jason kini added
  • Milestone changed from sage-5.10 to sage-duplicate/invalid/wontfix
  • Status changed from needs_review to needs_info

If this is still valid, the relevant code has changed slightly, so this wouldn't apply. Also, we should probably create a pull request.

Or, as Tim suggests, if not, we could indeed close this. It's unfortunate William didn't attach a sample sws :( I'd go with Tim, though I think that we should have at least one current sagenb guru also confirm his statement.

comment:5 Changed 8 years ago by jason

I know I fixed a lot of issues involving errors like this last year.

Changed 4 years ago by chapoton

comment:7 Changed 3 years ago by embray

  • Resolution set to worksforme
  • Status changed from needs_info to closed

Appears to be fixed in SageNB; see the upstream issue.

Note: See TracTickets for help on using tickets.