Re: [Sikuli-driver] [Question #269254]: Wait until the process is completed

2015-07-17 Thread fordox
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Status: Answered = Solved

fordox confirmed that the question is solved:
Thanks RaiMan, that solved my question.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-17 Thread RaiMan
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Status: Open = Answered

RaiMan proposed the following answer:
tried urllib2 ??

about Popen.pid see the mentioned doc.

about how to terminate a process using its pid form command line see the
Windows docs.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-16 Thread fordox
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Status: Answered = Solved

fordox confirmed that the question is solved:
Thanks RaiMan, that solved my question.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-16 Thread RaiMan
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Status: Open = Answered

RaiMan proposed the following answer:
the docs for Jython subprocess.Popen
http://www.jython.org/docs/library/subprocess.html

there is Popen.poll() that can be used to check, wether the subprocess has 
terminated or not.
Furthermore it does not look like you want to use the output to STDOUT of the 
called program, so you should not specify the stdout parameter.

BTW: I would never name a variable the same as a used module or class.

while True:
  # ... some code
  if typei == '1':
url = '/getsome' + rid
args = ('C:\file.exe', '--silent' + url)
myApp = subprocess.Popen(args)
hasTerminated = False
shouldStop = time.time() + 180
while not hasTerminated:
  ret = myApp.poll()
  if ret:
hasTerminated = True
break
  if time.time()  shouldStop:
myApp.terminate()
break
  if not hasTerminated:
continue

# code in case it terminated within 180 secs

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-16 Thread fordox
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Status: Solved = Open

fordox is still having a problem:
there is an error:

[error] AttributeError ( 'Popen' object has no attribute 'terminate' )

on myApp.terminate()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-16 Thread RaiMan
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Status: Open = Answered

RaiMan proposed the following answer:
If you are working with the latest build of SikuliX 1.1.0, it should be
there.

… if not (using Jython  2.7) you have to get the pid using Popen.pid
and issue a kill command.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-16 Thread fordox
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Status: Answered = Open

fordox is still having a problem:
In latest version of Sikuli unfortunately does not work properly module
Urlib

[error] java.lang.IllegalStateException ( java.lang.IllegalStateException: 
failed to create a child event loop )
[error] --- Traceback --- error source first line: module ( function ) 
statement 26: urllib ( module )

So I'm using version 1.0.1. 
Please give an example, how I can using Popen.pid and issue a kill command? :-) 
if not more difficult.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-15 Thread Eugene S
Question #269254 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/269254

Eugene S posted a new comment:
You probably should ask that question on StackOverflow or some other QA
site as it's not a Sikuli specific question.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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 #269254]: Wait until the process is completed

2015-07-15 Thread fordox
New question #269254 on Sikuli:
https://answers.launchpad.net/sikuli/+question/269254

While True:

   . # some code

if typei == '1': 
url =  '/getsome' + rid
args = ('C:\file.exe', '--silent' + url)
popen = subprocess.Popen(args, stdout=subprocess.PIPE)
popen.communicate()

   . # some code

continue

How do I make a script waiting for 180 seconds after the start of the file?
If the process of the file.exe has not been completed - to return to the 
beginning of the cycle
If the process was complete - continue code execution

SIGALRM doesn't work in Windows :-(


-- 
You received this question notification because you are a member of
Sikuli Drivers, which 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