override method sleep

Asked by Chetan on 2021-04-15

Hi
we have our own method waittime similar to sleep and would like users to use that in framework and not sleep
is there a way we can show a message/ print a message whenever sleep is called or overide the sleep method and call our own method?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Best RaiMan (raimund-hocke) said : #1

yes, possible:

- make a script, that contains your sleep def: (myoverrides.py)
def sleep(time):
     print "mysleep variant"

- in the script to use your sleep:
if not somepath in sys.path:
    sys.path.insert(0, somepath)
from myoverrides import *
sleep(10)

... should print
mysleep variant

.. where homepath is the folder, that contains the myoverrides.py

Chetan (cshamdas) said : #2

Thanks RaiMan, that solved my question.