Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77255

Re: xml issue with Type 'bool' cannot be serialized

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'tree': 0.05; "subject:' ": 0.07; 'password)': 0.09; 'subject:xml': 0.09; 'sys,': 0.09; 'def': 0.12; '63,': 0.16; 'dump': 0.16; 'subject:issue': 0.16; 'typeerror:': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'thu,': 0.19; 'import': 0.22; 'aug': 0.22; 'issue.': 0.22; 'print': 0.22; 'config': 0.24; '---': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'code': 0.31; 'os,': 0.31; 'file': 0.32; '(most': 0.33; 'device': 0.34; 'subject:with': 0.35; 'received:google.com': 0.35; 'skip:j 20': 0.36; 'clear': 0.37; 'to:addr:python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'here': 0.66; 'user,': 0.69; '81,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=PmuJgBeKcqCPCHMg8hyXefOugv99CuFrgxBVoSMeHmg=; b=KjNAABHC0fGwqmqcawnwLMtvZv5chfoSWic3qBx1cm0hbLTKxr29MyIjmzr/k9C8b5 rMOHDG2ghNmafi0GIpypFSDsniy8zm+hw6FZ6XYWFrrJb7Vl2WLh5Lil1zkfz8Qd+brP Qg0wrkc9r/oHDChmnp5SaQC+CSwVQXfedoykwZWD0ncjOou7bN8I/5mCTFTg4ArcZYOQ YIIkg4ZBSszkOEsgPNAfW37K9WyTGFQn6AS8AyXvbDwVM6K8gRGtAmrNfA4pLbmIQrXR q754iltlPXy+aNp6E6Bo8GWK9sVpWOJSh3+MxPPEBt2jzByhNe62bKBkSqYoxJaMNdHU Lzyg==
X-Received by 10.66.154.234 with SMTP id vr10mr12508000pab.44.1409289855321; Thu, 28 Aug 2014 22:24:15 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <53FF9808.5040403@enabled.com>
References <53FF9808.5040403@enabled.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 28 Aug 2014 23:23:35 -0600
Subject Re: xml issue with Type 'bool' cannot be serialized
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13597.1409289858.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409289858 news.xs4all.nl 2921 [2001:888:2000:d::a6]:60676
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77255

Show key headers only | View raw


On Thu, Aug 28, 2014 at 2:58 PM, Noah <noah-list@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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: xml issue with Type 'bool' cannot be serialized Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-28 23:23 -0600

csiph-web