Mac OSX 10.7
Python 2.7
Django 1.3
Markdown 2.0.3
I am trying to migrate from a wordpress blog to a django-powered one. I am using pigmonkey’s django-basic-apps for it’s xml parsing script, but every time I attempt it, markdown keeps raising “markdown.MarkdownException: UnicodeDecodeError: Markdown only accepts unicode or ascii input.”
Full traceback:
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.
There’s nothing outside unicode in there, that I’ve found maybe you guys would have better luck.
I can upload the xml file too, if that would help
This should be fixed as of my most recent commit to my fork of django-basic-apps. The error was caused by passing the post’s body and tease through the inline parser before passing it to Markdown (which is necessary for other reasons). I don’t fully understand why the error was being thrown, but you can read today’s commit message for what I do know:
https://github.com/pigmonkey/django-vellum/commit/1d5fb4743a7fc34e4b6cd415144ad232bbc3f0ad
By the way, I just noticed this question today as I was doing some Googling, trying to understand this error. For future reference, if you contact me through Github, or through my website, or create an Issue for the project on Github, or email me, I’ll probably respond a lot faster! I’m always interested to hear about any bugs found in my projects.