rossant / ipymd

Use the IPython notebook as an interactive Markdown editor
BSD 3-Clause "New" or "Revised" License
484 stars 42 forks source link

bug: keyerror 'markdown' on master with python 3 #73

Closed RafalSkolasinski closed 8 years ago

RafalSkolasinski commented 8 years ago

Hi,

I tried to use ipymd now with python3 on my laptop but I got following error after starting notebook server on the http://localhost:8888/tree

Server error: Traceback (most recent call last): File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/base/handlers.py", line 436, in wrapper result = yield gen.maybe_future(method(self, *args, **kwargs)) File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 1008, in run value = future.result() File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/concurrent.py", line 232, in result raise_exc_info(self._exc_info) File "<string>", line 3, in raise_exc_info File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 282, in wrapper yielded = next(result) File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/services/contents/handlers.py", line 126, in get path=path, type=type, format=format, content=content, File "/home/arymanus/dev3/lib/python3.4/site-packages/ipymd/core/contents_manager.py", line 86, in get file_extension = format_manager().file_extension(self.format) File "/home/arymanus/dev3/lib/python3.4/site-packages/ipymd/core/format_manager.py", line 143, in file_extension return self._formats[name]['file_extension'] KeyError: 'markdown'

terminal errors are as following

(dev3)arymanus:~> jupyter notebook
[I 15:39:44.992 NotebookApp] ipymd format markdown could not be loaded: No module named 'yaml'
[I 15:39:45.006 NotebookApp] ipymd format atlas could not be loaded: No module named 'yaml'
[I 15:39:45.012 NotebookApp] ipymd format opendocument could not be loaded: The 'odfpy' distribution was not found and is required by the application
[I 15:39:45.057 NotebookApp] Serving notebooks from local directory: /home/arymanus
[I 15:39:45.057 NotebookApp] 0 active kernels 
[I 15:39:45.058 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 15:39:45.058 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Created new window in existing browser session.
[E 15:39:45.959 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/base/handlers.py", line 436, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 1008, in run
        value = future.result()
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/concurrent.py", line 232, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 282, in wrapper
        yielded = next(result)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/services/contents/handlers.py", line 126, in get
        path=path, type=type, format=format, content=content,
      File "/home/arymanus/dev3/lib/python3.4/site-packages/ipymd/core/contents_manager.py", line 86, in get
        file_extension = format_manager().file_extension(self.format)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/ipymd/core/format_manager.py", line 143, in file_extension
        return self._formats[name]['file_extension']
    KeyError: 'markdown'
[E 15:39:45.960 NotebookApp] Uncaught exception GET /api/contents?type=directory&_=1447166385733 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/contents?type=directory&_=1447166385733', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36', 'X-Requested-With': 'XMLHttpRequest', 'Accept-Language': 'en-US,en;q=0.8', 'Connection': 'keep-alive', 'Host': 'localhost:8888', 'Referer': 'http://localhost:8888/tree', 'Accept-Encoding': 'gzip, deflate, sdch', 'Accept': 'application/json, text/javascript, */*; q=0.01'})
    Traceback (most recent call last):
      File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/base/handlers.py", line 436, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 1008, in run
        value = future.result()
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/concurrent.py", line 232, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 282, in wrapper
        yielded = next(result)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/services/contents/handlers.py", line 126, in get
        path=path, type=type, format=format, content=content,
      File "/home/arymanus/dev3/lib/python3.4/site-packages/ipymd/core/contents_manager.py", line 86, in get
        file_extension = format_manager().file_extension(self.format)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/ipymd/core/format_manager.py", line 143, in file_extension
        return self._formats[name]['file_extension']
    KeyError: 'markdown'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/web.py", line 1445, in _execute
        result = yield result
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 1008, in run
        value = future.result()
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/concurrent.py", line 232, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/gen.py", line 1014, in run
        yielded = self.gen.throw(*exc_info)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/base/handlers.py", line 454, in wrapper
        self.finish(json.dumps(reply))
      File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/base/handlers.py", line 375, in finish
        return super(APIHandler, self).finish(*args, **kwargs)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/web.py", line 934, in finish
        self._log()
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/web.py", line 1474, in _log
        self.application.log_request(self)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/tornado/web.py", line 1936, in log_request
        self.settings["log_function"](handler)
      File "/home/arymanus/dev3/lib/python3.4/site-packages/notebook/log.py", line 46, in log_request
        log_method(json.dumps(request.headers, indent=2))
      File "/usr/lib/python3.4/json/__init__.py", line 237, in dumps
        **kw).encode(obj)
      File "/usr/lib/python3.4/json/encoder.py", line 194, in encode
        chunks = list(chunks)
      File "/usr/lib/python3.4/json/encoder.py", line 429, in _iterencode
        o = _default(o)
      File "/usr/lib/python3.4/json/encoder.py", line 173, in default
        raise TypeError(repr(o) + " is not JSON serializable")
    TypeError: <tornado.httputil.HTTPHeaders object at 0x7f2321089668> is not JSON serializable
[E 15:39:45.962 NotebookApp] Cannot send error response after headers written

my virtualenv configuration

(dev3)arymanus:~> pip freeze
You are using pip version 6.1.1, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
alabaster==0.7.6
appnope==0.1.0
Babel==2.1.1
backports-abc==0.4
Cython==0.23.4
decorator==4.0.4
docutils==0.12
gnureadline==6.3.3
holoviews==1.3.2
ipykernel==4.1.1
ipymd==0.1.2.dev0
ipyparallel==4.1.0
ipython==4.0.0
ipython-genutils==0.1.0
ipywidgets==4.1.1
Jinja2==2.8
jsonschema==2.5.1
jupyter==1.0.0
jupyter-client==4.1.1
jupyter-console==4.0.3
jupyter-core==4.0.6
jupyterhub==0.3.0
kwant==1.1.1.dev6+g195e424
MarkupSafe==0.23
mistune==0.7.1
mock==1.3.0
nbconvert==4.1.0
nbformat==4.0.1
nose==1.3.7
notebook==4.0.6
numpy==1.10.1
numpydoc==0.5
pamela==0.2.1
pandas==0.17.0
param==1.3.2
path.py==8.1.2
pbr==1.8.1
pexpect==4.0.1
pickleshare==0.5
ptyprocess==0.5
Pygments==2.0.2
pyreadline==2.1
python-dateutil==2.4.2
pytz==2015.7
pyzmq==15.0.0
qtconsole==4.1.0
requests==2.8.1
scipy==0.16.1
simplegeneric==0.8.1
six==1.10.0
snowballstemmer==1.2.0
Sphinx==1.3.1
sphinx-rtd-theme==0.1.9
SQLAlchemy==1.0.9
sympy==0.7.6.1
terminado==0.5
testpath==0.2
tinyarray==1.0.5.dev9+gcdf987c
tornado==4.3
traitlets==4.0.0

I will be happy to provide any more information you may need.

RafalSkolasinski commented 8 years ago

@rossant, do you think that it might really be some bug or just problem with mine installation?

rossant commented 8 years ago

looks like you're missing some dependencies

[I 15:39:44.992 NotebookApp] ipymd format markdown could not be loaded: No module named 'yaml'
[I 15:39:45.006 NotebookApp] ipymd format atlas could not be loaded: No module named 'yaml'
[I 15:39:45.012 NotebookApp] ipymd format opendocument could not be loaded: The 'odfpy' distribution was not found and is required by the application
RafalSkolasinski commented 8 years ago

Yes, indeed installing yaml with

pip install pyyaml

is solving the problem.

Maybe it would be good idea to add it to ipymd dependencies?

Thanks!

On Thu, Nov 12, 2015 at 10:33 PM, Cyrille Rossant notifications@github.com wrote:

looks like you're missing some dependencies

[I 15:39:44.992 NotebookApp] ipymd format markdown could not be loaded: No module named 'yaml' [I 15:39:45.006 NotebookApp] ipymd format atlas could not be loaded: No module named 'yaml' [I 15:39:45.012 NotebookApp] ipymd format opendocument could not be loaded: The 'odfpy' distribution was not found and is required by the application

— Reply to this email directly or view it on GitHub https://github.com/rossant/ipymd/issues/73#issuecomment-156243018.

rossant commented 8 years ago

agreed! do you want to do a PR?

RafalSkolasinski commented 8 years ago

Sure! I will probably do it tomorrow though.

On Thu, Nov 12, 2015 at 10:38 PM, Cyrille Rossant notifications@github.com wrote:

agreed! do you want to do a PR?

— Reply to this email directly or view it on GitHub https://github.com/rossant/ipymd/issues/73#issuecomment-156244152.

RafalSkolasinski commented 8 years ago

Okay, I did it. I hope it's okay. Sorry for not linking PR to this issue, I didn't know how to do it. I think this issue may be closed.