Re: [Sikuli-driver] [Question #679317]: organising images and functions in different scripts in sikuli

2019-03-25 Thread RaiMan
Question #679317 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679317

Status: Open => Answered

RaiMan proposed the following answer:
ok, I have to fix that later today and report back.

-- 
You received this question notification because your team Sikuli Drivers
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 #679317]: organising images and functions in different scripts in sikuli

2019-03-25 Thread Sreelekshmi
Question #679317 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679317

Status: Solved => Open

Sreelekshmi is still having a problem:
Hi Raiman,

Faced another issue . below code giving error at line 7 for reload

[error] script [ MSLS_Functions ] stopped with error in line 7
[error] NameError ( name 'Images' is not defined )

import os
import sys
from sikuli import*
imagePath="C:\\Tools\\Images.sikuli"
addImagePath(imagePath)
from Images import*
reload(Images)
def Launch_app():
if exists(icon):
doubleClick(icon)

Launch_app()

-- 
You received this question notification because your team Sikuli Drivers
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 #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread partosXP
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532

Status: Answered => Open

partosXP is still having a problem:
Yes, it works like you said - all process terminated.
And i've got some pleasure  -  watching it dying)

But i dont want to kill all process, i just want to start next loop of main 
script.
I'm using this tool for non-stop monitoring. One loop failed - log error and go 
next try. Just looking for way to force "next loop", whithout waiting all 
timeout in command "wait(obj,300)".
I'm sorry if i didnt explained it clearly.

Great thanks for your time, btw. May be its just impossible to do it like this 
:(
Feel free to close this thread, if you have no more ideas too.

P.S> main script (remind):

While True:
try:
onAppear("error.png",ErrorHandler)
observe(300,background = True) #set observer
wait("1.png",300) #up to 5 min waiting. Needs force "continue" loop here, if 
handler catches error (no loose time for waiting and dont execute other steps).
click("1.png")
except FindFailed:
print("cant find image")

-- 
You received this question notification because your team Sikuli Drivers
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 #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread RaiMan
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532

RaiMan proposed the following answer:
this you can do:

def handler(e):
# whatever needs to be done
RUNTIME.terminate(1, "script ececution stopped in handler)

everything else as normal

if you run this in the IDE, take care, that the script is saved before
running, since this ia brute force and stops the IDE.

most elegant:
- edit and save your script in the IDE
- run your script from commandline and watch it dying ;-)

-- 
You received this question notification because your team Sikuli Drivers
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 #679546]: I wanted to type a command in Command prompt using type("send.exe 127.0.0.1 9089\"gcs23.yaml\""); ,But in the command prompt "" it types as send.exe 127.0.0.1 9...@

2019-03-25 Thread Chetan B
New question #679546 on Sikuli:
https://answers.launchpad.net/sikuli/+question/679546

HI Raiman,


I totally apologize  last time i raised it as bug,its my mistake please forgive 
me.


I wanted to type a command in command prompt which includes "" double quotes ,I 
tried your previous solution by putting slash,
it didnt work.


When i run the script it  is entering @ instead of " i.e


send.exe 127.0.0.1 9...@gcs23.yaml@


please provide me solution.

Is there any way i can store all my command in a variable and then use 
type(varaibel name);
please let me know.

Regards,
Chetan

-- 
You received this question notification because your team Sikuli Drivers
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 #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread RaiMan
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532

Status: Open => Answered

RaiMan proposed the following answer:
in a few minutes I will have a solution for you ;-)

-- 
You received this question notification because your team Sikuli Drivers
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 #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread partosXP
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532

Status: Needs information => Open

partosXP gave more information on the question:
Using "exit()" - just stops execution of handler-function, but dont make
any change to main process script.

def ErrorHandler(event):
print "First Error message by Handler"
exit()
print "Second Error message by Handler"

- it prints only first messege, not the second one (execution
terminated, i think)

 And after that - still waiting 300 sec for target element in main
script.

-- 
You received this question notification because your team Sikuli Drivers
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] [Bug 1821614] Re: How to enter command using type command which has a double quotes intit (send.exe 127.0.0.1 9089 "gcs23.yaml")

2019-03-25 Thread RaiMan
** Changed in: sikuli
   Status: New => Invalid

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1821614

Title:
  How to enter command using type command which has a double quotes
  intit (send.exe 127.0.0.1 9089 "gcs23.yaml")

Status in Sikuli:
  Invalid

Bug description:
  Hi RAiman,


  I have to type the below command with double quotes included in it.

  send.exe 127.0.0.1 9089 "GSME_GCS13b_Supplier - NC_ch1.yaml

  type ()Command will not accept "" inside it.

  
  Sikuli version:

  
  com.sikulix
  sikulixapi
  1.1.0
  

  PLease provide solution.

  
  Regards,
  Chetan

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1821614/+subscriptions

___
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] [Bug 1821608] Re: I have to type a command with double quotes also cannot do it using type command eg: send.exe 127.0.0.1 9089 "gcs23.yaml"

2019-03-25 Thread RaiMan
** Changed in: sikuli
   Status: New => Invalid

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1821608

Title:
  I have to type a command with double quotes also cannot do it using
  type command eg: send.exe 127.0.0.1 9089 "gcs23.yaml"

Status in Sikuli:
  Invalid

Bug description:
  Hi,

  In the command prompt i need to execute a command with double quotes

  send.exe 127.0.0.1 9089 "gcs23.yaml"

  
  if i use type("send.exe 127.0.0.1 9089 "gcs23.yaml"")

  it shows error .
  PLease let me know how to execute this command using type() command.

  
  Regards,
  Chetan

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1821608/+subscriptions

___
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] [Bug 1821614] [NEW] How to enter command using type command which has a double quotes intit (send.exe 127.0.0.1 9089 "gcs23.yaml")

2019-03-25 Thread Chetan B
Public bug reported:

Hi RAiman,


I have to type the below command with double quotes included in it.

send.exe 127.0.0.1 9089 "GSME_GCS13b_Supplier - NC_ch1.yaml

type ()Command will not accept "" inside it.


Sikuli version:


com.sikulix
sikulixapi
1.1.0


PLease provide solution.


Regards,
Chetan

** Affects: sikuli
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1821614

Title:
  How to enter command using type command which has a double quotes
  intit (send.exe 127.0.0.1 9089 "gcs23.yaml")

Status in Sikuli:
  New

Bug description:
  Hi RAiman,


  I have to type the below command with double quotes included in it.

  send.exe 127.0.0.1 9089 "GSME_GCS13b_Supplier - NC_ch1.yaml

  type ()Command will not accept "" inside it.

  
  Sikuli version:

  
  com.sikulix
  sikulixapi
  1.1.0
  

  PLease provide solution.

  
  Regards,
  Chetan

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1821614/+subscriptions

___
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 #679535]: How to execute a script done in pl sql in skikulix?

2019-03-25 Thread RaiMan
Question #679535 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679535

Status: Open => Answered

RaiMan proposed the following answer:
the easiest possibility, if these condidtions are met:
- on Windows
- the script can be run by using a .cmd batch file
- the script outpouts the payload to standard out

then this will work:
info = run("cmd.exe wrapperOfPLSQLScript.cmd")

info will be a string containing lines (terminated with \n)

--- first line: 
return code (a number string)
--- second line and following:
the lines output from your script

if an error occured, there will be a line
*error*
followed by the error output

Be aware: there might be encoding issues to be solved with the returned
string.

-- 
You received this question notification because your team Sikuli Drivers
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 #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread RaiMan
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532

Status: Open => Needs information

RaiMan requested more information:
what happens if you simply use exit() in the handler?

-- 
You received this question notification because your team Sikuli Drivers
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 #679535]: How to execute a script done in pl sql in skikulix?

2019-03-25 Thread RaiMan
Question #679535 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679535

RaiMan proposed the following answer:
sorry, the command must be

info = run("cmd.exe /c wrapperOfPLSQLScript.cmd")

to let the cmd.exe return after script termination

-- 
You received this question notification because your team Sikuli Drivers
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] [Bug 1821608] Re: I have to type a command with double quotes also cannot do it using type command eg: send.exe 127.0.0.1 9089 "gcs23.yaml"

2019-03-25 Thread Chetan B
PLEASE DO PROVIDE ME SOLUTION IMMEDIATLY.

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1821608

Title:
  I have to type a command with double quotes also cannot do it using
  type command eg: send.exe 127.0.0.1 9089 "gcs23.yaml"

Status in Sikuli:
  New

Bug description:
  Hi,

  In the command prompt i need to execute a command with double quotes

  send.exe 127.0.0.1 9089 "gcs23.yaml"

  
  if i use type("send.exe 127.0.0.1 9089 "gcs23.yaml"")

  it shows error .
  PLease let me know how to execute this command using type() command.

  
  Regards,
  Chetan

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1821608/+subscriptions

___
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] [Bug 1821608] [NEW] I have to type a command with double quotes also cannot do it using type command eg: send.exe 127.0.0.1 9089 "gcs23.yaml"

2019-03-25 Thread Chetan B
Public bug reported:

Hi,

In the command prompt i need to execute a command with double quotes

send.exe 127.0.0.1 9089 "gcs23.yaml"


if i use type("send.exe 127.0.0.1 9089 "gcs23.yaml"")

it shows error .
PLease let me know how to execute this command using type() command.


Regards,
Chetan

** Affects: sikuli
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1821608

Title:
  I have to type a command with double quotes also cannot do it using
  type command eg: send.exe 127.0.0.1 9089 "gcs23.yaml"

Status in Sikuli:
  New

Bug description:
  Hi,

  In the command prompt i need to execute a command with double quotes

  send.exe 127.0.0.1 9089 "gcs23.yaml"

  
  if i use type("send.exe 127.0.0.1 9089 "gcs23.yaml"")

  it shows error .
  PLease let me know how to execute this command using type() command.

  
  Regards,
  Chetan

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1821608/+subscriptions

___
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 #679537]: Not able to get latest Sikuli IDE exe.

2019-03-25 Thread RaiMan
Question #679537 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679537

Status: Open => Answered

RaiMan proposed the following answer:
there is no exe.

only java jar files to be run with java.

start here:
http://sikulix.com

-- 
You received this question notification because your team Sikuli Drivers
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 #679537]: Not able to get latest Sikuli IDE exe.

2019-03-25 Thread deepti
New question #679537 on Sikuli:
https://answers.launchpad.net/sikuli/+question/679537

I was using Sikuli version 0.10.2 now i want to download latest version 1.1.4. 
But i am not able to get .exe for the particular version.
Could you please guide me? 

-- 
You received this question notification because your team Sikuli Drivers
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 #679535]: How to execute a script done in pl sql in skikulix?

2019-03-25 Thread Fernando Eduardo
New question #679535 on Sikuli:
https://answers.launchpad.net/sikuli/+question/679535

I'm setting up an automation process and got into a part that I need to run a 
script done in pl / sql. That when I run I need to pass some information that 
is typed.
Is it possible to perform this action in sikulix or do I need to transform the 
pl / sql script into the python standard?

-- 
You received this question notification because your team Sikuli Drivers
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 #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread partosXP
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532

Status: Answered => Open

partosXP is still having a problem:
Thanks for the answer,RaiMan!

I thought about this way, but it can't  *interrupt* current running of
the loop, only break the next one.

I checked this code one more time now - after revealing of error.png -
it still waiting for target 1.png for 300 sec more and break loop only
after this.

The main idea of the question - how interrupt main script, while its running, 
by background process and its handler.
(ofcourse, i can rework script to not use so long waitings, but its just an 
example. The same problem if we have many short steps and one error handler for 
all of them.)

Wrap all micro steps to construction like:
***
while True:
if shouldStop: 
break
ifexists("object"):
break
wait(1)
***
- seems to be so monstrous... i cant believe that its part of light side of 
power). is it?

-- 
You received this question notification because your team Sikuli Drivers
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] [Bug 1821530] Re: [1.1.4] running plain Jython from commandline: import problems --- fixed 2019-03-25 build#257

2019-03-25 Thread RaiMan
** Summary changed:

- [1.1.4] running plain Jython from commandline: import problems
+ [1.1.4] running plain Jython from commandline: import problems --- fixed 
2019-03-25 build#257

** Changed in: sikuli
   Status: In Progress => Fix Committed

** Changed in: sikuli
   Importance: Medium => Critical

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1821530

Title:
  [1.1.4] running plain Jython from commandline: import problems ---
  fixed 2019-03-25 build#257

Status in Sikuli:
  Fix Committed

Bug description:
  ** problem
  using:
  import org.sikuli.script.SikulixForJython
  from sikuli import *
  import whatever

  leads to:
  import whatever
  File "C:\Users\rmhde\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", 
line 50, in find_module 
  module_path = JH.get().findModule(module_name, 
package_path, sys.path) 
 at 
java.io.File.(Unknown Source) 

 at 
org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889)   

 at 
org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556)   

 at 
org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590)   

 at 
org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530)  

 at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown 
Source) 
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 

 at java.lang.reflect.Method.invoke(Unknown Source) 

 java.lang.NullPointerException: 
java.lang.NullPointerException
  
-
   
  I've used the latest sikulixapi.jar and got:

  Python 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
  [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_201
  Traceback (most recent call last):
    File ".\test.py", line 44, in 
  download(url=installer_url)
    File ".\test.py", line 31, in download
  r = requests.get(url, stream=True)
    File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 75, 
in get
  return request('get', url, params=params, **kwargs)
    File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 60, 
in request
  return session.request(method=method, url=url, **kwargs)
    File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py", line 
519, in request
  prep = self.prepare_request(req)
    File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py", line 
449, in prepare_request
  auth = get_netrc_auth(request.url)
    File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py", line 
172, in get_netrc_auth
  from netrc import netrc, NetrcParseError
    File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py", line 
172, in get_netrc_auth
  from netrc import netrc, NetrcParseError
    File "D:\Users\user\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", 
line 50, in find_module
  module_path = JH.get().findModule(module_name, package_path, sys.path)
  at java.io.File.(Unknown Source)
  at 
org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889)
  at org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556)
  at org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590)
  at 
org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)

  I do not get this with an older version.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1821530/+subscriptions


Re: [Sikuli-driver] [Question #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread RaiMan
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532

Status: Open => Answered

RaiMan proposed the following answer:
solution: use a global variable

***
def ErrorHandler(event):
global shouldStop
print("Error found")
shouldStop = True

shouldStop = False
While True:
if shouldStop: break
try:
onAppear("error.png",ErrorHandler)
observe(300,background = True) #set observer
wait("1.png",300) #up to 5 min waiting
click("1.png")
except FindFailed:
print("cant find image")
***

... mind the indents ;-)

-- 
You received this question notification because your team Sikuli Drivers
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 #679532]: How to stop waiting in main script by observer handler

2019-03-25 Thread partosXP
New question #679532 on Sikuli:
https://answers.launchpad.net/sikuli/+question/679532

Hello! Thx for a good tool.

I have a standard script with loop and try/except logic like:
***
While True:
try:
wait("1.png",300) #up to 5 min waiting
click("1.png")
except FindFailed:
print("cant find image")
***
and it works perfectly.

But sometimes i have an error messeges in my program and i want to handle them 
whithout many "if - else" constractions and whithout waiting 5 minutes.
I found "onAppear" and "observe" functions and it seems exactly what i need, 
but i cant stop waiting in main script by handler. For example:

***
def ErrorHandler(event):
print("Error found")

While True:
try:
onAppear("error.png",ErrorHandler)
observe(300,background = True) #set observer
wait("1.png",300) #up to 5 min waiting
click("1.png")
except FindFailed:
print("cant find image")
***

If i get error messege(error.png) after 30 sec - observer catch it, print 
"Error found", but main script still running and i have to loose 250sec more 
for waiting 1.png.
Is it possible to force next loop in main script from handler?

I checked two ways:
1) add something like "break" or "continue" in handler function (ok, that was 
stupid i suppose, it doesnt work even in clear python)
2) raise Exception in handler function to force end of loop in main script.
raise
raise FindFailed
raise FindFailed ("test")
return raise
return FindFailed
and it doesnt work.

Am i doing something wrong or it's not possible at all?

P.S. i found workaround with many loops and with "if exists" instead of 
long-wait, but it's not beauty and not usable in some more difficult situations 
(like one possible error in many steps).
for i in range (30):
if exists(1.png)
else if exists(2.png)
wait(3)


-- 
You received this question notification because your team Sikuli Drivers
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] [Bug 1821530] Re: [1.1.4] module not found with latest sikulixapi.jar

2019-03-25 Thread RaiMan
yes, a bug with the latest version.

** Changed in: sikuli
   Status: Opinion => In Progress

** Summary changed:

- [1.1.4] module not found with latest sikulixapi.jar
+ [1.1.4] running plain Jython from commandline: import problems

** Description changed:

+ ** problem
+ using:
+ import org.sikuli.script.SikulixForJython
+ from sikuli import *
+ import whatever
+ 
+ leads to:
+ import whatever
+ File "C:\Users\rmhde\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", 
line 50, in find_module 
  module_path = JH.get().findModule(module_name, 
package_path, sys.path) 
 at 
java.io.File.(Unknown Source) 

 at 
org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889)   

 at 
org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556)   

 at 
org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590)   

 at 
org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530)  

 at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown 
Source) 
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 

 at java.lang.reflect.Method.invoke(Unknown Source) 

 java.lang.NullPointerException: 
java.lang.NullPointerException
+ 
-
+  
  I've used the latest sikulixapi.jar and got:
- 
  
  Python 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
  [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_201
  Traceback (most recent call last):
-   File ".\test.py", line 44, in 
- download(url=installer_url)
-   File ".\test.py", line 31, in download
- r = requests.get(url, stream=True)
-   File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 75, 
in get
- return request('get', url, params=params, **kwargs)
-   File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 60, 
in request
- return session.request(method=method, url=url, **kwargs)
-   File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py", line 
519, in request
- prep = self.prepare_request(req)
-   File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py", line 
449, in prepare_request
- auth = get_netrc_auth(request.url)
-   File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py", line 
172, in get_netrc_auth
- from netrc import netrc, NetrcParseError
-   File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py", line 
172, in get_netrc_auth
- from netrc import netrc, NetrcParseError
-   File "D:\Users\user\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", 
line 50, in find_module
- module_path = JH.get().findModule(module_name, package_path, sys.path)
- at java.io.File.(Unknown Source)
- at 
org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889)
- at org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556)
- at org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590)
- at 
org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
- at java.lang.reflect.Method.invoke(Unknown Source)
+   File ".\test.py", line 44, in 
+ download(url=installer_url)
+   File ".\test.py", line 31, in download
+ r = requests.get(url, stream=True)
+   File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 75, 
in get
+ return request('get', url, params=params, **kwargs)
+   File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 60, 
in request
+ return session.request(method=method, url=url, **kwargs)
+   File "D:\Users\user\jython27\Lib\site-packages\requests\se