Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; "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; 'import': 0.22; 'issue.': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'config': 0.24; '---': 0.24; 'skip:( 20': 0.30; 'code': 0.31; 'os,': 0.31; 'file': 0.32; '(most': 0.33; 'device': 0.34; 'subject:with': 0.35; 'skip:j 20': 0.36; 'clear': 0.37; 'to:addr:python-list': 0.38; 'list,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'received:173': 0.61; 'here': 0.66; 'user,': 0.69; '81,': 0.84 X-Virus-Scanned: Debian amavisd-new at enabled.com Date: Thu, 28 Aug 2014 13:58:48 -0700 From: Noah User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: python-list@python.org Subject: xml issue with Type 'bool' cannot be serialized Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409259948 news.xs4all.nl 2833 [2001:888:2000:d::a6]:48178 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77236 Hi list, I am not clear how to fix this issue. Traceback (most recent call last): File "./command.py", line 81, in 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