← Back to team overview

sikuli-driver team mailing list archive

[Question #702998]: script that runs from IDE but not from Commandline

 

New question #702998 on SikuliX:
https://answers.launchpad.net/sikuli/+question/702998

Hello,
I had a script that was running ok if launched from the IDe but if, after generating runnable jar, launching it from commandline was failing.
The script is using OCR and the tessedit_char_blacklist that contains some char that I don't want to be found, like "£".
I cut away anything that worked and I got this minimal script that exhibits the problem:

#!/usr/bin/python
# -*- coding: utf-8 -*-
popup("£")

When launched from the IDE the popup shows "£", but the executable generated jar does not contain the script class and so it doesn't works.
i.e. If the pop-up contains something like "x" the executable jar contains these folder and files:
META-INF\
org\
__main__$py.class
__run__$py.class
TestNoCmd$py.class
and works if launched from commandline.
If the popup contains the "£" char the TestNoCmd$py.class file disappears from the jar and with the same commandline it doesn't works.
Since I need to exclude the pound char (and other) from the OCR, and to deliver the script launchable from commandline, there is a solution?

The output of the two commandline with -v -d3 option is this if everything works
c:\Projects\DataPurchase\REACT\SikuliX\Test_h20>"c:\Program Files\RedHat\java-1.8.0-openjdk\bin\java.exe"   -jar c:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar   -r  TestNoCmd_sikuli.jar -v -d3
[DEBUG]startUp: API: Running: C:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar
[DEBUG]startUp: API: AppData: C:\Users\MyUser\AppData\Roaming\Sikulix
[DEBUG]startUp: API: starting with classpath: c:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar ...
[DEBUG]startUp: API: no extensions.txt nor valid content
[35 debug] RunTime:temp folder ok: C:\Users\MyUser\AppData\Local\Temp\Sikulix_1870881543
Options: *** options dump
Options: testing =
Options: OptionsFile = C:\Users\MyUser\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.5 API
user.home: C:\Users\MyUser
work dir: c:\Projects\DataPurchase\REACT\SikuliX\Test_h20
running on Windows 10.0 from a jar
running Java Red Hat, Inc. 1.8.0_342-b07
java.io.tmpdir: C:\Users\MyUser\AppData\Local\Temp
app data folder: C:\Users\MyUser\AppData\Roaming\Sikulix
executing jar: C:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar
*** classpath dump sikulix
  0: file:/C:/Users/MyUser/Desktop/Down/SikuliX/sikulixapi-2.0.5-win.jar
*** classpath dump end
***** show environment end
[DEBUG]startUp: API: *********************** leaving start
[12 debug] Sikulix: starting API
[32 debug] RunTime:temp folder ok: C:\Users\MyUser\AppData\Local\Temp\Sikulix_1983411274
Options: *** options dump
Options: testing =
Options: OptionsFile = C:\Users\MyUser\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.5 API
user.home: C:\Users\MyUser
work dir: c:\Projects\DataPurchase\REACT\SikuliX\Test_h20
running on Windows 10.0 from a jar
running Java Red Hat, Inc. 1.8.0_342-b07
java.io.tmpdir: C:\Users\MyUser\AppData\Local\Temp
app data folder: C:\Users\MyUser\AppData\Roaming\Sikulix
executing jar: C:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar
*** classpath dump sikulix
  0: file:/C:/Users/MyUser/Desktop/Down/SikuliX/sikulixapi-2.0.5-win.jar
  1: file:/C:/Users/MyUser/Desktop/Down/SikuliX/sikulixapi-2.0.5-win.jar
*** classpath dump end
***** show environment end
[2553 debug] Runner: added: PackedSikulix [zip] application/zip
[2554 debug] Runner: init: class org.sikuli.script.runners.AbstractLocalFileScriptRunner: warning: not possible
[2554 debug] Runner: added: Text [txt] text/text
[2555 debug] Runner: added: SikulixJar [jar] text/jar
[2557 debug] Runner: added: Sikulix [] directory/sikulix
[2560 debug] Runner: added: PowerShell [ps1] text/powershell
[2570 debug] Runner: added: Jython [py] text/jython
[2571 debug] Runner: added: SikulixExecutableJar [executablejar] text/jar
[2577 debug] Runner: added: PackedSikulix [skl] text/skl
[2588 debug] Runner: added: NetworkRunner [] NET
[3234 debug] HotkeyManager: add Abort Hotkey: ALT+MAIUSC C (67, 9)
[3307 debug] Runner: runscript: running script: C:\Users\MyUser\AppData\Local\Temp\sikulix3779437648305334957\TestNoCmd$py.class
[3310 debug] JythonRunner: starting initialization
[5394 debug] Jython: added as Jython::sys.path[0]:
C:\Users\MyUser\AppData\Roaming\Sikulix\Lib\site-packages
[5397 debug] Jython: ***** sys.path
 0: C:\Users\MyUser\AppData\Roaming\Sikulix\Lib\site-packages
 1: C:\Users\MyUser\AppData\Roaming\Sikulix\Lib
 2: C:\Users\MyUser\Desktop\Down\SikuliX\Lib
 3: C:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar\Lib
 6: C:\Users\MyUser\.local\lib\jython2.7\site-packages
[5414 debug] JythonRunner: ready: version 2.7.2
[debug] ImagePath: new BundlePath: C:\Users\MyUser\AppData\Local\Temp\sikulix3779437648305334957
[debug] Jython: SikulixForJython: init: starting
[debug] RunTime:resourceLocation: (class org.sikuli.script.support.RunTime) /Lib/sikuli/Sikuli.py
[debug] Jython: sikuli/*.py is on Jython::sys.path at:
C:\Users\MyUser\AppData\Roaming\Sikulix\Lib
[debug] Jython: added as Jython::sys.path[0]:
C:\Users\MyUser\AppData\Roaming\Sikulix\Lib\site-packages
[debug] Jython: SikulixForJython: init: success
[debug] Jython: sikuli: Sikuli: starting init
[debug] Screen: initScreens: starting
[debug] Screen: Accessing: GraphicsEnvironment.getLocalGraphicsEnvironment()
[debug] Screen: Accessing: GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()
[debug] Screen: Monitor 0: (-1920, 113) 1920 x 1080
[debug] Screen: ScreenDevice 1 has (0,0) --- will be primary Screen(0)
[debug] Screen: Monitor 1: (0, 0) 1920 x 1080
[debug] Screen: initScreens: monitor mouse check
[debug] Screen: *** checking: R[0,0 1920x1080]@S(0) center: (960, 540) --- OK
[debug] Screen: *** multimonitor click check: R[-1920,113 1920x1080]@S(1) center: (-960, 653) --- NOT OK:  (-958, 652)
[debug] Device: Mouse: moved externally: now (-958,652) was (-959,653) (mouseMovedResponse 0)
[error] RobotDesktop: checkMousePosition: should be L[1221,287]@S(0) - but is not!
Possible cause in case you did not touch the mouse while script was running:
 Mouse actions are blocked generally or by the frontmost application.
You might try to run the SikuliX stuff as admin.
[debug] Screen: initScreens: ending
[debug] Jython: use as default region: R[0,0 1920x1080]@S(0)
[debug] Image: BufferedImage: (1920, 1080)
[debug] Jython: sikuli: Sikuli: ending init
[debug] Jython: use as default region: R[0,0 1920x1080]@S(0)
[debug] Image: BufferedImage: (1920, 1080)
[debug] HotkeyManager: reset: removed all SikuliX hotkeys.
[debug] HotkeyController: stopping hotkey provider
[debug] RunTime:***** final cleanup at System.exit() *****
[debug] FileManager: deleteFileOrFolder:
C:\Users\MyUser\AppData\Local\Temp\sikulix3779437648305334957
[debug] FileManager: deleteFileOrFolder:
C:\Users\MyUser\AppData\Local\Temp\Sikulix_1983411274
[11631 debug] RunTime:***** final cleanup at System.exit() *****
[11647 debug] FileManager: deleteFileOrFolder:
C:\Users\MyUser\AppData\Local\Temp\Sikulix_1870881543

And this one when it doesn't works:
c:\Projects\DataPurchase\REACT\SikuliX\Test_h20>"c:\Program Files\RedHat\java-1.8.0-openjdk\bin\java.exe"   -jar c:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar   -r  TestNoCmd_sikuli.jar -v -d3
[DEBUG]startUp: API: Running: C:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar
[DEBUG]startUp: API: AppData: C:\Users\MyUser\AppData\Roaming\Sikulix
[DEBUG]startUp: API: starting with classpath: c:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar ...
[DEBUG]startUp: API: no extensions.txt nor valid content
[34 debug] RunTime:temp folder ok: C:\Users\MyUser\AppData\Local\Temp\Sikulix_161974167
Options: *** options dump
Options: testing =
Options: OptionsFile = C:\Users\MyUser\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.5 API
user.home: C:\Users\MyUser
work dir: c:\Projects\DataPurchase\REACT\SikuliX\Test_h20
running on Windows 10.0 from a jar
running Java Red Hat, Inc. 1.8.0_342-b07
java.io.tmpdir: C:\Users\MyUser\AppData\Local\Temp
app data folder: C:\Users\MyUser\AppData\Roaming\Sikulix
executing jar: C:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar
*** classpath dump sikulix
  0: file:/C:/Users/MyUser/Desktop/Down/SikuliX/sikulixapi-2.0.5-win.jar
*** classpath dump end
***** show environment end
[DEBUG]startUp: API: *********************** leaving start
[13 debug] Sikulix: starting API
[33 debug] RunTime:temp folder ok: C:\Users\MyUser\AppData\Local\Temp\Sikulix_1792812665
Options: *** options dump
Options: testing =
Options: OptionsFile = C:\Users\MyUser\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.5 API
user.home: C:\Users\MyUser
work dir: c:\Projects\DataPurchase\REACT\SikuliX\Test_h20
running on Windows 10.0 from a jar
running Java Red Hat, Inc. 1.8.0_342-b07
java.io.tmpdir: C:\Users\MyUser\AppData\Local\Temp
app data folder: C:\Users\MyUser\AppData\Roaming\Sikulix
executing jar: C:\Users\MyUser\Desktop\Down\SikuliX\sikulixapi-2.0.5-win.jar
*** classpath dump sikulix
  0: file:/C:/Users/MyUser/Desktop/Down/SikuliX/sikulixapi-2.0.5-win.jar
  1: file:/C:/Users/MyUser/Desktop/Down/SikuliX/sikulixapi-2.0.5-win.jar
*** classpath dump end
***** show environment end
[2367 debug] Runner: added: PackedSikulix [zip] application/zip
[2367 debug] Runner: init: class org.sikuli.script.runners.AbstractLocalFileScriptRunner: warning: not possible
[2368 debug] Runner: added: Text [txt] text/text
[2369 debug] Runner: added: SikulixJar [jar] text/jar
[2369 debug] Runner: added: Sikulix [] directory/sikulix
[2370 debug] Runner: added: PowerShell [ps1] text/powershell
[2377 debug] Runner: added: Jython [py] text/jython
[2377 debug] Runner: added: SikulixExecutableJar [executablejar] text/jar
[2377 debug] Runner: added: PackedSikulix [skl] text/skl
[2378 debug] Runner: added: NetworkRunner [] NET
[2397 debug] HotkeyManager: add Abort Hotkey: ALT+MAIUSC C (67, 9)
[error] Runner: runscript: No runner for given jar: !C:\Projects\DataPurchase\REACT\SikuliX\Test_h20\TestNoCmd_sikuli.jar
[2919 debug] HotkeyManager: reset: removed all SikuliX hotkeys.
[2919 debug] HotkeyController: stopping hotkey provider
[3547 debug] RunTime:***** final cleanup at System.exit() *****
[3553 debug] FileManager: deleteFileOrFolder:
C:\Users\MyUser\AppData\Local\Temp\Sikulix_1792812665
[5141 debug] RunTime:***** final cleanup at System.exit() *****
[5154 debug] FileManager: deleteFileOrFolder:
C:\Users\MyUser\AppData\Local\Temp\Sikulix_161974167



-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.