[check] Linux: App.open not work in run script mode: missing error console

Bug #1220976 reported by shi.zhao
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
Medium
RaiMan

Bug Description

   Following is simple sikuli script:
       App.open("xclock");
       sleep(5);
       App.close("xclock");

   This work fine when i click "Run" in sikuli-IDE environment.
   But it not work when we run with "sikuli/runIDE -r sanity.sikuli"

   I guess sikuli missed the error console, because flowing script work fine.
       App.open("xclock > /tmp/aa.log 2>&1");
       sleep(5);
       App.close("xclock");

  =======================================================================================
   sikuli version:
         Build: 1.0.1 20AUG2013135242

   Linux version:
         Oracle Linux Server release 6.4
         Kernel \r on an \m

   Package version:
        leptonica-1.69 tesseract-ocr-3.0.2 xdotool-2.20110530.1
        opencv-2.4.6.1 wmctrl-1.07

   Java version:
       java version "1.7.0_25"
       Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
       Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

   Console message: (-d 3 -c)
       [julierobot@shi ~]$ /usr/local/sikuli/runIDE -d 3 -c -r ~/sikuli/script/sanity.sikuli
       running SikuliX-IDE: -Xmx512M -Dapple.laf.useScreenMenuBar -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine
       -jar /usr/local/sikuli/sikuli-ide.jar -d 3 -c -r /home/julierobot/sikuli/script/sanity.sikuli
       [debug] SikuliIDE: Switching to SikuliScript with option -r, -t or -i
       [debug] SikuliScript: CmdOrg: -d 3 -c -r /home/julierobot/sikuli/script/sanity.sikuli
       [debug] Running on Java 7 (1.7.0_25-b15)
       [debug] --- Sikuli parameters ---
       [debug] 1: -d
       [debug] 2: 3
       [debug] 3: -c
       [debug] 4: -r
       [debug] 5: /home/julierobot/sikuli/script/sanity.sikuli
       [debug] SikuliScript: givenScriptName: /home/julierobot/sikuli/script/sanity.sikuli
       [debug] SikuliX Jython Support Build: 1.0.1 20AUG2013135242
       [debug] Trying to run script: /home/julierobot/sikuli/script/sanity.sikuli/sanity.py
       [debug] JythonScriptRunner: : executeScriptHeader: adding SikuliX Lib path to sys.path
       /usr/local/sikuli/sikuli-ide.jar/Lib
        ............................
        [debug] ResourceLoaderBasic: loadLib: VisionProxy
        [debug] ResourceLoaderBasic: loadLib: Found: VisionProxy
        [debug] ResourceLoaderBasic: loadLib: Now loaded: VisionProxy
        [debug] Jython: sikuli: Sikuli: import App
        [debug] Screen: initScreens: basic initialization (1 Screen(s) found)
        [debug] *** monitor configuration (primary: 0) ***
        [debug] Screen 0: S(0)[0,0 1280x960]
        [debug] *** end monitor configuration ***
        [debug] Jython: sikuli: Sikuli: import Key
        [debug] Jython: sikuli: Sikuli: import from Basics
        [debug] Jython: sikuli: Sikuli: import from compare
        [debug] Jython: sikuli: Sikuli: init SikuliImporter
        [debug] Jython: sikuli: Sikuli: import SikuliScript
        [debug] Jython: init SCREEN as ()
        [debug] JythonScriptRunner: : executeScriptHeader: PyInit: resetROI()
        [debug] JythonScriptRunner: : executeScriptHeader: PyInit: setShowActions(False)
        [debug] Sikuli-IDE environment setup: 4655
        [log] openApp: xclock
        [log] App.open xclock(4767)
        [log] closeApp: xclock
        [debug] SikuliXFinal: cleanUp: 0
        [info] Exit code: 0
        [debug] JythonScriptRunner: : executeScriptHeader: at exit: path:
        [debug] JythonScriptRunner: : executeScriptHeader: /usr/local/sikuli/sikuli-ide.jar/Lib

Revision history for this message
shi.zhao (shi-zhao) wrote :

"Not work" means there is no application display in window, the program start and quit immediately .

Revision history for this message
RaiMan (raimund-hocke) wrote :

This is not really a problem with Sikuli.

the internally used command to finally start the given "app string" is like this:

sh -c ( xclock ) &\necho -n $!

or second version

sh -c ( xclock > /tmp/aa.log 2>&1 ) &\necho -n $!

which is started in a subprocess.

I am not that Linux expert, so it would help me to understand, what is going on here.

Revision history for this message
RaiMan (raimund-hocke) wrote :

The difference between the 2 run modes from IDE and command line is, that with IDE we already have a windowed foreground process and when running from command line we do not have that.

Revision history for this message
shi.zhao (shi-zhao) wrote :

I'm not sure if you paste has something wrong, with "(", we will got syntax error.

[julierobot@shi ~]$ cat aa.sh
sh -c ( xclock ) &
echo -n $!
[julierobot@shi ~]$ ./aa.sh
./aa.sh: line 1: syntax error near unexpected token `('
./aa.sh: line 1: `sh -c ( xclock ) &'

============================================================================

I removed the "(" and ")" from your paste, got following:
    [julierobot@shi ~]$ cat aa.sh
    sh -c xclock > /tmp/aa.log 2>&1 &
    echo -n $!
    [julierobot@shi ~]$ sh aa.sh
    24011[julierobot@shi ~]$
    [julierobot@shi ~]$ cat bb.sh
    sh -c xclock &
    echo -n $!
    [julierobot@shi ~]$ sh bb.sh
    24014[julierobot@shi ~]$ Warning: Missing charsets in String to FontSet conversion
    Warning: Unable to load any usable fontset

Revision history for this message
RaiMan (raimund-hocke) wrote :

ok, thanks.

Already was irritated about the brackets, but they seem to be some quoting for the Java exec command, that in Sikuli gets the string and are removed before scheduling the command.

with aa.sh:
the aa.log should contain the same warning message like displayed by bb.sh - right?

When in the next time I make tests on Linux, I will look after that.

summary: - [LINUX] App.open not work, run script mode; missing error console
+ [1.0.1] Linux: App.open not work in run script mode: missing error
+ console
Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.0
RaiMan (raimund-hocke)
Changed in sikuli:
milestone: 1.1.0 → 1.2.0
RaiMan (raimund-hocke)
Changed in sikuli:
milestone: 2.0.0 → 2.0.1
summary: - [1.0.1] Linux: App.open not work in run script mode: missing error
+ [check] Linux: App.open not work in run script mode: missing error
console
Revision history for this message
Priyanka Chaturvedi (priyanka2210) wrote :

Hi RaiMan,

I am also facing the same issue, as above.

App.open did not work when running through sikulix api (2.0.1)

iepath = r'"C:\Program Files\Internet Explorer\iexplore.exe"';
App.open(iepath + " " + "https://google.com")

Is there any update on this bug?

Revision history for this message
Priyanka Chaturvedi (priyanka2210) wrote :

By the way, I am using windows 10

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.