No parsers found error when running from command line
Hello there,
I've been trying to parse an xml file and write selected nodes to a text file. If I run the script from within Sikuli IDE, everything works fine. The run produces expected xmltest.txt file into the current directory.
The problem arises when I run the same script from command line., it throws No parsers found error.
I run it as,
D:\INSTALLER\
The error is,
+++ trying to start Sikuli Script
[error] Script aborted with some error:
Traceback (most recent call last):
File "D:\test.py", line 22, in <module>
t1 = parse_xml(
File "D:\test.py", line 15, in parse_xml
dom = read_xml(file_name)
File "D:\test.py", line 10, in read_xml
pdata = parseString(data)
File "D:\INSTALLER\
File "D:\INSTALLER\
File "D:\INSTALLER\
File "D:\INSTALLER\
xml.sax.
Sikuli Script:
-------------
import os
from xml.dom.minidom import parseString
cd = os.path.
file_name = cd+"\\test.xml"
# read xml
def read_xml(xml_file):
f = open(xml_file, 'r')
data = f.read()
pdata = parseString(data)
f.close()
return pdata
def parse_xml(
dom = read_xml(file_name)
node_list = dom.getElements
first_node = node_list[
return first_node
fo = open(cd+
fo.write("\nFirst node value\n")
t1 = parse_xml(
fo.write(str(t1))
fo.close()
XML file:
----------
<?xml version="1.0"?>
<test>
<tag1>
<node>
</tag1>
</test>
Output xmltest.txt file, if run through Sikuli IDE,
-----------------
First node value
VALUE
Occasionally, the IDE also throws same parser not found error that can be rid of by clearing all sikuli temp data.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- RaiMan Edit question
- Solved by:
- RaiMan
- Solved:
- Last query:
- Last reply: