Giter Site home page Giter Site logo

Comments (7)

RaiMan avatar RaiMan commented on May 21, 2024
  1. thanks for feedback
  2. understood - will try to fix it

from sikulix1.

romangrothausmann avatar romangrothausmann commented on May 21, 2024

Many thanks @RaiMan for your looking into this. Even though java -jar /opt/sikulix.jar -r seems to be the general recommendation to run SikuliX scripts without GUI, I got what I needed by running jython and importing sikuli-jython conditionally (to preserve GUI portability for editing), i.e. in the sikuliy python script sikuli-script.py I added:

try:
    import org.sikuli.script.SikulixForJython
    from sikuli.Sikuli import *
except ImportError:
    print("No run by sikuli jython")
....
exit(X)

and call it for the headless tests with Xvfb as:

java -cp "/opt/sikulixapi.jar:/opt/jython-standalone-2.7.1.jar" org.python.util.jython sikuli-script.py

Then, the return code from java corresponds to that of exit(X) in the script

from sikulix1.

RaiMan avatar RaiMan commented on May 21, 2024

thanks for the workaround.

Be aware: With this variant, there is no default image path set. With the recommended way, the default image path is set to the bundle path (folder .sikuli containing the .py)

So I have to fix it anyways ;-)

from sikulix1.

romangrothausmann avatar romangrothausmann commented on May 21, 2024

Many thanks @RaiMan for that hint. I had been stuck on that, and found the following workaround:

try:
    import org.sikuli.script.SikulixForJython
    from sikuli.Sikuli import *
    import inspect
    import os.path
    addImagePath(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))
except ImportError:
    print("No run by sikuli jython")

from sikulix1.

RaiMan avatar RaiMan commented on May 21, 2024

ok, exam passed ;-)

BTW: this is sufficient:

    import org.sikuli.script.SikulixForJython
#    from sikuli.Sikuli import *
    from sikuli import *
# already imported
#    import inspect
#    import os.path
    addImagePath(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from sikulix1.

balmma avatar balmma commented on May 21, 2024

PR #74 might fix this one.

from sikulix1.

RaiMan avatar RaiMan commented on May 21, 2024

Please reopen, if the mentioned PR #74 did not solve your problem

from sikulix1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.