xml issue with Type 'bool' cannot be serialized

Ian Kelly ian.g.kelly at gmail.com
Fri Aug 29 01:23:35 EDT 2014


On Thu, Aug 28, 2014 at 2:58 PM, Noah <noah-list at enabled.com> wrote:
> Hi list,
>
> I am not clear how to fix this issue.
>
> Traceback (most recent call last):
>   File "./command.py", line 81, in <module>
>     connect(host, USER, PASSWORD)
>   File "./command.py", line 63, in connect
>     dump = etree.tostring(xml_cmd)
>   File "lxml.etree.pyx", line 3165, in lxml.etree.tostring
> (src/lxml/lxml.etree.c:69414)
> TypeError: Type 'bool' cannot be serialized.
>
>
> here is snippets from the code
>
>
>
> --- code ---
>
> from jnpr.junos import Device
> from jnpr.junos.utils.config import Config
> from lxml import etree
> import jnpr.junos.exception
> import sys, os, time, re, getopt
>
> def connect(host, user, password):
>     conn = Device(host=host, user=user, password=password).open()
>
>     xml_cmd = ''
>     xml_cmd = conn.rpc.get_configuration()
>     dump = etree.tostring(xml_cmd)
>     print dump

What is xml_cmd? Is it actually an ElementTree tree as required by
etree.tostring?



More information about the Python-list mailing list