From: Waylan L. <way...@ic...> - 2014-04-29 00:08:53
|
Trent, Sorry for the delayed response. The error message indicates that the serializer is coming across a non-ElementTree object in the tree (it obviously doesn't know how to serialize it). I did a quick look through your code and didn't see where is was coming from but perhaps that will steer you the right direction. Perhaps when I have some more time I'll take a closer look. Waylan -----Original Message----- From: Trent "TiZ" McPheron [mailto:twi...@gm...] Sent: Thursday, April 24, 2014 3:58 PM To: pyt...@li... Subject: [Python-markdown-discuss] Cannot serialize error in custom block processor Hi. I'm trying to create an extension for Markdown to support the custom HTML tags used in Dedalus, an interactive fiction system. I have the inline stuff working perfectly fine, but I want to create a custom block type for the <page>, <paragraph>, and <object> blocks it uses. I figured an intuitive way to handle that would be to indent the contents. The code I have written so far to try and accomplish this is here: http://pastebin.com/4pVhzeqW Right now, it dumps the following stack trace: Traceback (most recent call last): File "./markded.py", line 81, in <module> """) File "/usr/lib/python2.7/site-packages/markdown/__init__.py", line 300, in convert output = self.serializer(root) File "/usr/lib/python2.7/site-packages/markdown/serializers.py", line 276, in to_xhtml_string return _write_html(ElementTree(element).getroot(), format="xhtml") File "/usr/lib/python2.7/site-packages/markdown/serializers.py", line 198, in _write_html qnames, namespaces = _namespaces(root, default_namespace) File "/usr/lib/python2.7/site-packages/markdown/serializers.py", line 264, in _namespaces add_qname(key) File "/usr/lib/python2.7/site-packages/markdown/serializers.py", line 244, in add_qname _raise_serialization_error(qname) File "/usr/lib/python2.7/site-packages/markdown/serializers.py", line 78, in _raise_serialization_error "cannot serialize %r (type %s)" % (text, type(text).__name__) TypeError: cannot serialize <built-in function id> (type builtin_function_or_method) What am I doing wrong that is causing this error to occur? I'm not a good Python programmer by any stretch of the imagination, and I imagine my code is probably pretty horrible. I'm sure I am going about this completely wrong, and I'm sure that's related to why I'm getting this error. Thank you for your time. ---------------------------------------------------------------------------- -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform _______________________________________________ Python-markdown-discuss mailing list Pyt...@li... https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |