Opened 10 years ago

Closed 10 years ago

#10860 closed defect (fixed)

R package documentation not accessible from notebook

Reported by: aginiewicz Owned by: jason, mpatel, was
Priority: minor Milestone: sage-4.7.1
Component: notebook Keywords: unicode, notebook, docstring, R, sd31
Cc: kcrisman, jason, mpatel, timdumol Merged in: sage-4.7.1.alpha4
Authors: Andrzej Giniewicz Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

The documentation of package R is not accessible from notebook, while it works from command line.

sage: r.lm?
<html><!--notruncate-->
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "_sage_input_3.py", line 10, in <module>
   exec compile(u'print _support_.docstring("r.lm", globals(),
system="sage")' + '\n', '', 'single')
 File "", line 1, in <module>

 File "/opt/sage/devel/sagenb/sagenb/misc/support.py", line 263, in docstring
   return html_markup(s)
 File "/opt/sage/devel/sagenb/sagenb/misc/support.py", line 288, in html_markup
   return '<div class="docstring">' + preamble + '<pre>' + s + '</pre></div>'
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
116: ordinal not in range(128)
</html>

See this sage-support thread.

Apply 10860.patch and trac_10860-review.patch to sagenb.

Attachments (2)

10860.patch (647 bytes) - added by aginiewicz 10 years ago.
decode string before converting to html
trac_10860-review.patch (843 bytes) - added by kcrisman 10 years ago.
Apply after initial patch

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by aginiewicz

decode string before converting to html

comment:1 Changed 10 years ago by aginiewicz

  • Status changed from new to needs_review

Added simple fix for the issue mentioned. With the patch R documentation works again. I also checked documentation for plot. Also, all tests on 4.6.1 passed.

comment:2 Changed 10 years ago by kcrisman

  • Cc kcrisman added

comment:3 Changed 10 years ago by kcrisman

  • Authors set to Andrzej Giniewicz
  • Description modified (diff)

comment:4 Changed 10 years ago by kcrisman

  • Cc jason mpatel timdumol added
  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to needs_info

This works. I'm not quite sure why - is all R doc in UTF-8 now? maybe this happened with the last R upgrade - but it does.

Positive review if we can't think of a way to doctest this. Is this something we can doctest using EMBEDDED_MODE? cc:ing in a few people who might know the answer to that question.

comment:5 Changed 10 years ago by kcrisman

  • Status changed from needs_info to needs_review

Apparently it is.

sage: a = r.lm
sage: b = a._sage_doc_()
sage: b[:150]
'lm                    package:stats                    R Documentation\n\n_\x08F_\x08i_\x08t_\x08t_\x08i_\x08n_\x08g _\x08L_\x08i_\x08n_\x08e_\x08a_\x08r _\x08M_\x08o_\x08d_\x08e_\x08l_\x08s\n\n_\x08D_\x08e_\x08s_\x08c_\x08r_\x08'

I've added a doctest for this. There are warnings, but they are ok - I think they are just because of the R formatting. Warnings of this type do not affect passing doctests.

comment:6 Changed 10 years ago by kcrisman

  • Keywords sd31 added
  • Status changed from needs_review to positive_review

Changed 10 years ago by kcrisman

Apply after initial patch

comment:7 Changed 10 years ago by kcrisman

  • Description modified (diff)

comment:8 Changed 10 years ago by kcrisman

To the notebook repository, of course.

comment:9 Changed 10 years ago by jdemeyer

  • Description modified (diff)
  • Merged in set to sage-4.7.1.alpha4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.