ohbarye / markdown-server

Simple markdown server written in Python. It converts your markdown file to HTML and returns a response as text/html.
https://pypi.python.org/pypi/markdown-server
MIT License
44 stars 20 forks source link

Internal Server Error (HTTP 500) when loading images #3

Open cptx032 opened 8 years ago

cptx032 commented 8 years ago

A markdown like:

![Screenshot](01.png)

produces the following error:

Traceback (most recent call last):
  File "D:\Python27\Scripts\bottle.py", line 862, in _handle
    return route.call(**args)
  File "D:\Python27\Scripts\bottle.py", line 1732, in wrapper
    rv = callback(*a, **ka)
  File "\desktop\markdown-server\src\markdownserver-master\markdownserver\__init__.py", line 10, in gfmize
    html_file_name = converter.convert(resource)
  File "\desktop\markdown-server\src\markdownserver-master\markdownserver\md_to_html.py", line 30, in convert
    code = md.markdown(self.read_md(file_name), extensions=[markdown_type])
  File "\desktop\markdown-server\src\markdownserver-master\markdownserver\md_to_html.py", line 35, in read_md
    return md_file.read()
  File "d:\python27\lib\codecs.py", line 674, in read
    return self.reader.read(size)
  File "d:\python27\lib\codecs.py", line 480, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte
127.0.0.1 - - [28/Jul/2016 15:46:57] "GET /01.png HTTP/1.1" 500 902977

The image is located in markdownserver/resources/markdown