Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Dec 2018 14:31:10 -0500
From:      Mark Saad <nonesuch@longcount.org>
To:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   libxo question
Message-ID:  <CAMXt9NZOa0CRdAB2jERK7iP3VXB367g0Y0oYaL6q893RBr3aTw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
All
  I am playing around with procstat and libxo on 12-STABLE from
yesterday . I wanted to get a list of  thread_id's for some processes.
I wrote a quick python script to grab the data but xml output is not
well formed. Here is my sample script , which should work on python
2.7

----8<-----------------------
  1 import subprocess as sp
  2 import os,sys
  3 import pprint as pp
  4 import xml.etree.cElementTree as ET
  5
  6
  7 FNULL = open(os.devnull, 'w')
  8 cmd = "procstat --libxo xml -ta"
  9 p = sp.Popen(cmd, shell=True, stdout=sp.PIPE,stderr=FNULL,
executable="/bin/sh")
 10 text , err = p.communicate()
 11
 12 root = ET.fromstring(text)
 13
 14 pp.pprint(root)
 15
 16 sys.exit(1)
------------>8-----------------------

I am constantly getting this odd issue about the xml being not well formatted

Traceback (most recent call last):
  File "/tmp/test.py", line 12, in <module>
    root = ET.fromstring(text)
  File "<string>", line 124, in XML
cElementTree.ParseError: not well-formed (invalid token): line 1, column 32

Attached is a copy of the xml.   Any guidance would be helpful.


-- 
mark saad | nonesuch@longcount.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMXt9NZOa0CRdAB2jERK7iP3VXB367g0Y0oYaL6q893RBr3aTw>