Modify ↓
Opened 9 years ago
Closed 9 years ago
#13126 closed defect (invalid)
AttributeError: 'unicode' object has no attribute 'read'
| Reported by: | Ryan J Ollos | Owned by: | tkob-trac |
|---|---|---|---|
| Priority: | normal | Component: | JupyterNotebookPlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: |
Description
I encountered two issues.
jupyteris required: documented in JupyterNotebookPlugin@3AttributeError: 'unicode' object has no attribute 'read'
21:44:27 Trac[api] WARNING: HTML preview using JupyterNotebookRenderer with <RenderingContext <Resource u'wiki:PythonNotebook'> - <Resource u'wiki:PythonNotebook'> - <Resource u'wiki:PythonNotebook'>> failed:
Traceback (most recent call last):
File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/mimeview/api.py", line 814, in render
rendered_content, filename, url)
File "/Users/rjollos/Documents/Workspace/trac-dev/trac-hacks/jupyternotebookplugin/1.0/tracjupyternotebook/renderer.py", line 32, in render
notebook = nbformat.reads(content.read(), as_version=4)
AttributeError: 'unicode' object has no attribute 'read'
Attachments (0)
Change History (4)
comment:1 follow-up: 3 Changed 9 years ago by
comment:3 Changed 9 years ago by
Thank you for the report. As a quick reply to your question:
Replying to Ryan J Ollos:
The plugin is intended to be used in a WikiProcessor like this?
{{{#!ipynb }}}
This plugin is intended to be used in the repository browser to preview ipynb files and I don't think ipynb is useful as Wiki macro, since you usually don't type ipynb source directly (it is non-human-friendly JSON format).
comment:4 Changed 9 years ago by
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
That make sense. Thanks for clarifying.
Note: See
TracTickets for help on using
tickets.



The plugin is intended to be used in a WikiProcessor like this?
{{{#!ipynb }}}If so, the following change fixes the issue:
tracjupyternotebook/renderer.py
.read(), as_version=4)