Mac OSX 10.7 Python 2.7 Django 1.3 Markdown 2.0.3
我正在尝试从wordpress博客迁移到django支持的博客。我正在使用pigmonkey的django-basic-apps作为它的xml解析脚本,但每次我尝试时,markdown都会一直提升“markdown.MarkdownException:UnicodeDecodeError:Markdown只接受unicode或ascii输入。”
完整追溯:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Users/mycomputer/.virtualenvs/zachswhite/lib/python2.7/site-packages/django_basic_apps-0.8-py2.7.egg/basic/blog/management/commands/wordpress_import.py", line 100, in handle
post.save()
File "/Users/mycomputer/.virtualenvs/zachswhite/lib/python2.7/site-packages/django_basic_apps-0.8-py2.7.egg/basic/blog/models.py", line 77, in save
self.body_rendered = mark_safe(formatter(self.body_rendered, filter_name=self.markup))
File "/Users/mycomputer/.virtualenvs/zachswhite/lib/python2.7/site-packages/django_markup-0.3-py2.7.egg/django_markup/markup.py", line 90, in __call__
return filter_class().render(text, **filter_kwargs)
File "/Users/mycomputer/.virtualenvs/zachswhite/lib/python2.7/site-packages/django_markup-0.3-py2.7.egg/django_markup/filter/markdown_filter.py", line 21, in render
text = markdown(text, **kwargs)
File "/Users/mycomputer/.virtualenvs/zachswhite/lib/python2.7/site-packages/markdown/__init__.py", line 598, in markdown
return md.convert(text)
File "/Users/mycomputer/.virtualenvs/zachswhite/lib/python2.7/site-packages/markdown/__init__.py", line 377, in convert
message(CRITICAL, 'UnicodeDecodeError: Markdown only accepts unicode or ascii input.')
File "/Users/mycomputer/.virtualenvs/zachswhite/lib/python2.7/site-packages/markdown/__init__.py", line 112, in message
raise MarkdownException, text
markdown.MarkdownException: UnicodeDecodeError: Markdown only accepts unicode or ascii input.
那里没有外面的unicode,我发现也许你们会有更好的运气。
我也可以上传xml文件,如果有帮助的话
答案 0 :(得分:0)
这应该修复我最近提交到django-basic-apps的分支。错误是由于传递帖子的主体并在将其传递给Markdown之前挑逗内联解析器(这是other reasons所必需的)。我不完全理解为什么错误被抛出,但你可以阅读今天的提交信息,我知道的是: https://github.com/pigmonkey/django-vellum/commit/1d5fb4743a7fc34e4b6cd415144ad232bbc3f0ad
顺便说一下,我今天刚刚注意到这个问题,因为我正在做一些谷歌搜索,试图理解这个错误。为了将来参考,如果您通过Github或通过我的网站与我联系,或者在Github上为项目创建问题,或给我发电子邮件,我可能会更快地回复!我总是很想知道我的项目中发现的任何错误。