Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-26 Thread Sunil
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Sunil posted a new comment:
Finally, the issue got resolved from the clues RaiMan posted on linked
bug 1210474.

a Sikuli script should not be named as a Python module, when this
Python module should be imported.

I didn't had any script with name xml.sikuli but was not noticing the
another script having name with another Python module struct.sikuli.
The xml parser script was running successfully if placed into some other
location, but the moment it put into the library of all other scripts
(where the culprit struct.sikuli was lying) it started throwing Parser
not found error.

Even if you create a dummy directory with this name (struct.sikuli) the
xml parsing script (as posted into initial post) will fail with parser
not found error, which otherwise works fine!

Thanks for all your support, it got resolved finally.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-26 Thread Sunil
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Sunil confirmed that the question is solved:
Thanks RaiMan, that solved my question.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-14 Thread RaiMan
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Status: Answered = Solved

RaiMan changed the question status:
is solved

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-14 Thread Sunil
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Sunil posted a new comment:
Hi Raiman,

Thank you for the detailed suggestion.
I really appreciate your efforts put on Sikuli project.

Though I'm yet to try it, one interesting fact in my case is I haven't
named any script/module as xml.sikuli or xml.py. All I meant by
imported a 'module' which is saved as .sikuli script for parsing xml
file is any user defined module name (not native python module name, as
you mentioned xml.sikuli).

I'll update my findings here once done with it.
Thanks,

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-13 Thread Sunil
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Sunil posted a new comment:
From the bug 1210474 discussion,

a Sikuli script should not be named as a Python module, when this
Python module should be imported.

This is exactly what I did, imported a module which is saved as .sikuli
script for parsing an xml. I tried the from modname import this or
from modname import * but that didn't help. Isn't it conventional to
import python modules with the file name. Will you please suggest a
better/standard way to avoid such issues?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-13 Thread RaiMan
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

RaiMan proposed the following answer:
--- Isn't it conventional to import python modules with the file name?
Of course it is.
But that is not the question here.

Sikuli as a convenience feature allows to import other .sikuli scripts
as modules. Together with this convenience, Sikuli adds the .sikuli
folder to the image path, so you do not need to handle the submodule
images separately.

This is implemented internally as a hook into the Jython import process.

lets make an example: 
You made submodule.sikuli, that contains some supporting functions to be used 
all over the place.

the usage would be e.g.
from submodule import *

This looks exactly like a normal Python import, that should find and
import a file named submodule.py from sys.path

But since we are using Sikuli to run our scripts:
- Sikuli first searches for a submodule.sikuli on sys.path. 
- then it tells the Jython import, to import the contained submodule.py
- and it adds submodule.sikuli to Sikuli's image path

If Sikuli does not find a submodule.sikuli, it delegates the further
processing to Jython import, which might or might not find a
submodule.py

In your case you did not even name a submodule like a Jython module to
import (xml), but the main script was named xml.sikuli. But since the
working folder (the folder where the script run started from) is always
on sys.path for Sikuli imports, the xml.sikuli is found first (and of
course does not contain the expected substructure) and hence hides the
wanted Jython module xml.

So a bit more precise the rule should read:
A Sikuli script, that can be found on sys.path at runtime, should not be named 
as a Python module, that is to be imported in the same script run.

To avoid such clashes, I use script names like testSomefeature.sikuli,
when I want to try out a Python/Jython module somefeature.py.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-09 Thread RaiMan
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Assignee: None = RaiMan

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-09 Thread RaiMan
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

RaiMan posted a new comment:
linked this question to bug 1210474, to have it together

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-09 Thread RaiMan
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Linked to bug: #1210474
https://bugs.launchpad.net/bugs/1210474
[1.0] Problems importing xml.dom.minidom in script running mode

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-08 Thread Sunil
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Sunil posted a new comment:
Hi Raimund,
I did found a workaround to avoid the parser issue in my case, but the original 
issue persists and I'm bit curious to find out the root-cause. If following 
information makes any sense to probe into,

1. While running the script in command-line mode as script-name.sikuli (i.e. 
without exclusively specifying the jython) the error comes.
example: D:\INSTALLER\sikuli-script.cmd -r D:\Scripts\script-name.sikuli

2. While running the same script but as python script with sikuli-script.jar 
and jython, it works.
example: java -cp sikuli-script.jar org.python.util.jython 
D:\Scripts\script-name.sikuli\script-name.py

I'm using a Win7 x64 machine with Java7 x64, with home variables set for
both and included into system path too.

Thanks,

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-08-01 Thread RaiMan
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Status: Open = Answered

RaiMan proposed the following answer:
--1. I surely ran it from command line using sikuli-script.jar.

--2. my test proves, that the problem is not the xml-parsing stuff as
such. If the string to parse is readable it works.

So, yes, the problem might be with the file containing the xml.
Might be an encoding problem: take care, that your file is stored as utf-8 and 
read it using utf-8 encoding.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-07-31 Thread Sunil
New question #21 on Sikuli:
https://answers.launchpad.net/sikuli/+question/21

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\sikuli-script.cmd -r D:\test.sikuli

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_name)
  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\sikuli-script.jar\Lib\xml\dom\minidom.py, line 1934, in 
parseString
  File D:\INSTALLER\sikuli-script.jar\Lib\xml\dom\minidom.py, line 1907, in 
_do_pulldom_parse
  File D:\INSTALLER\sikuli-script.jar\Lib\xml\dom\pulldom.py, line 351, in 
parseString
  File D:\INSTALLER\sikuli-script.jar\Lib\xml\sax\__init__.py, line 94, in 
make_parser
xml.sax._exceptions.SAXReaderNotAvailable: No parsers found


Sikuli Script:
-
import os
from xml.dom.minidom import parseString
cd = os.path.dirname(os.path.abspath(sys.argv[0]))
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(file_name):
dom = read_xml(file_name)
node_list = dom.getElementsByTagName('node')
first_node = node_list[0].firstChild.nodeValue
return first_node

fo = open(cd+'\\xmltest.txt', 'a')
fo.write(\nFirst node value\n)
t1 = parse_xml(file_name)
fo.write(str(t1))
fo.close()

XML file:
--
?xml version=1.0?
test
tag1
nodeVALUE/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.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-07-31 Thread RaiMan
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Status: Open = Answered

RaiMan proposed the following answer:
This worked for me in all cases:

from xml.dom.minidom import parseString
xml = '?xml version=1.0?testtag1nodeVALUE/node/tag1/test'
dom = parseString(xml)
node_list = dom.getElementsByTagName('node')
first_node = node_list[0].firstChild.nodeValue
print first_node

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #233331]: No parsers found error when running from command line

2013-07-31 Thread Sunil
Question #21 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/21

Status: Answered = Open

Sunil is still having a problem:
Thanks, RaiMan.
I hope, you also tried it with a separate test.xml file rather than defining 
xml tags into the sikuli script itself.
Also it's essential to run the script in command line mode, else the error may 
not come (though, occasionally it comes).
I've been having a hard time getting rid of this error, without any luck.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp