← Back to team overview

sikuli-driver team mailing list archive

[Bug 1545325] [NEW] [1.1.0] Jython scripting: exit() does not work anymore in observe handler function

 

Public bug reported:

------- workaround
use 
os._exit()
instead of
exit()

caveat: if running in IDE, this will also terminate the IDE. So take care to save your stuff before running.
You might also run the script from commandline (while still editing it in the IDE).

----------------------------------

I am using onAppear to catch a specific image on the screen. Once the image is there, I want the script to stop. I've been using exit() command for that. However, once I updated to ver. 1.1.0, exit() command is being omitted. The scripts executes until that command, and then ignores it and proceeds.
How I can stop scipt's execution under hanlder for onAppear?

def __onAppearForTheImage(self):
self.__reg.onAppear("imgPath", self.__handlerForTheImage)
self.__reg.observeInBackground(FOREVER)

def __handlerForTheImage(self, event):
print "Image found"
exit() # Ignores that line

** Affects: sikuli
     Importance: Medium
     Assignee: RaiMan (raimund-hocke)
         Status: In Progress

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

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

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Changed in: sikuli
    Milestone: None => 1.1.1

** Description changed:

- I am using onAppear to catch a specific image on the screen. Once the image is there, I want the script to stop. I've been using exit() command for that. However, once I updated to ver. 1.1.0, exit() command is being omitted. The scripts executes until that command, and then ignores it and proceeds. 
+ ------- workaround
+ use 
+ os._exit()
+ instead of
+ exit()
+ 
+ caveat: if running in IDE, this will also terminate the IDE. So take care to save your stuff before running.
+ You might also run the script from commandline (while still editing it in the IDE).
+ 
+ ----------------------------------
+ 
+ I am using onAppear to catch a specific image on the screen. Once the image is there, I want the script to stop. I've been using exit() command for that. However, once I updated to ver. 1.1.0, exit() command is being omitted. The scripts executes until that command, and then ignores it and proceeds.
  How I can stop scipt's execution under hanlder for onAppear?
  
  def __onAppearForTheImage(self):
  self.__reg.onAppear("imgPath", self.__handlerForTheImage)
  self.__reg.observeInBackground(FOREVER)
  
  def __handlerForTheImage(self, event):
  print "Image found"
  exit() # Ignores that line

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

Title:
  [1.1.0] Jython scripting: exit() does not work anymore in observe
  handler function

Status in Sikuli:
  In Progress

Bug description:
  ------- workaround
  use 
  os._exit()
  instead of
  exit()

  caveat: if running in IDE, this will also terminate the IDE. So take care to save your stuff before running.
  You might also run the script from commandline (while still editing it in the IDE).

  ----------------------------------

  I am using onAppear to catch a specific image on the screen. Once the image is there, I want the script to stop. I've been using exit() command for that. However, once I updated to ver. 1.1.0, exit() command is being omitted. The scripts executes until that command, and then ignores it and proceeds.
  How I can stop scipt's execution under hanlder for onAppear?

  def __onAppearForTheImage(self):
  self.__reg.onAppear("imgPath", self.__handlerForTheImage)
  self.__reg.observeInBackground(FOREVER)

  def __handlerForTheImage(self, event):
  print "Image found"
  exit() # Ignores that line

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


Follow ups