Hari Sekhon wrote: > I've written an xml parser using xml.sax which works most of the time > but often traces back when trying to read a file. The output of the > traceback is below: > > Traceback (most recent call last): > File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", > line 271, in run > main() > File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", > line 502, in main > body = page_handler(*args, **cherrypy.request.paramMap) > File "netscan.py", line 160, in index > parse() > File "netscan.py", line 117, in parse > parser.parse ( scan_results ) > File "/usr/lib/python2.4/xml/sax/expatreader.py", line 107, in parse > xmlreader.IncrementalParser.parse(self, source) > File "/usr/lib/python2.4/xml/sax/xmlreader.py", line 125, in parse > self.close() > File "/usr/lib/python2.4/xml/sax/expatreader.py", line 217, in close > self.feed("", isFinal = 1) > File "/usr/lib/python2.4/xml/sax/expatreader.py", line 211, in feed > self._err_handler.fatalError(exc) > File "/usr/lib/python2.4/xml/sax/handler.py", line 38, in fatalError > raise exception > SAXParseException: /var/log/netscan/scanresults.txt:8:0: no element found > > > I don't understand why it's telling me that no element is found. It > looks like a problem inside xml.sax, but I'm not sure if I've caused > it or how. The xml file is good and is generated by nmap, it's not > missing tags or anything and is quite small. My script code which has > generated this is below: > [snip;] > (Well, really it runs from cherrypy but for brevity I've left that out) > Any help or pointers anybody could give would be greatly appreciated...
Maybe your script is trying to parse the xml file *while* it is being generated by nmap? How are you ensuring that the xml file is not read while being written by nmap? [sreeram;]
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list