Action 'Run program' bug or am I missing something?

Thru_K

Client
Регистрация
04.07.2012
Сообщения
45
Благодарностей
12
Баллы
0
Hi,

I've problem with action 'Run program' (in ZP 4.0.8.2).
I uses little python scripts for various purposes and I need to send exit code 0 or 1 to ZP.

I expected:
exit code == 0 -> success -> green dot or next action
exit code != 0 -> failure -> red dot (if not, BadEnd)

What happens:
If exit code = 0, no problem.
If exit code != 0 AND if there is a connection through the green dot to another action, ZP exit through the green dot.
if exit code != 0 AND if there is only a connection through the red dot to another action, ZP doesn't exit by red dot but produces a BadEnd.

Maybe am I missing something?

RunProgramProblem.PNG
 

Вложения

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
In the project you had attached I had no luck to even edit actions with program execution. I'm wondering on what version it was made on?
 

Thru_K

Client
Регистрация
04.07.2012
Сообщения
45
Благодарностей
12
Баллы
0
on ZP 4.0.8.2
 

Thru_K

Client
Регистрация
04.07.2012
Сообщения
45
Благодарностей
12
Баллы
0
Downloaded back the zip. Work on my side, not corrupted
 
Регистрация
01.02.2011
Сообщения
99
Благодарностей
15
Баллы
0
Quick look, the .pyw has a *nix hashbang filepath
 

Thru_K

Client
Регистрация
04.07.2012
Сообщения
45
Благодарностей
12
Баллы
0
Thanks CaptainObvious, but python scripts run fine and ZP receives exitcode (I see in log). Problem is with exit of actions.
 
Регистрация
01.02.2011
Сообщения
99
Благодарностей
15
Баллы
0
I was excited to see some .py for ZP... did'nt read all your post, lol.

I'm really interested to see this work, i always assumed that python with ZP was only a possibility via ironpy & codecreator.
 

Thru_K

Client
Регистрация
04.07.2012
Сообщения
45
Благодарностей
12
Баллы
0
You can run python scripts like any other .exe or .bat file :-)

In fact it is possible to work with the problem I described. If you connect "Run program" with "If" through successful exit (and "write exit code" to variable) , result of action is always successful and you can test exicode.

But it is not very clean...
 
  • Спасибо
Реакции: CaptainObvious

Boxcutter

Client
Регистрация
08.06.2012
Сообщения
127
Благодарностей
72
Баллы
28
Hi,
What happens:
If exit code = 0, no problem.
If exit code != 0 AND if there is a connection through the green dot to another action, ZP exit through the green dot.
if exit code != 0 AND if there is only a connection through the red dot to another action, ZP doesn't exit by red dot but produces a BadEnd.

Maybe am I missing something?
I'm getting exactly the same thing Thru and I can run your test template fine in 4.2.5.0

I also tested removing the bad end to see if it would use the red exit but it just pops up the error occurred debug failed box.

Another unusual thing with this action (I know you have come across this one yourself as well Thru)
is that you need to create a exit variable even if you don't use the write exit code option or it will
fail in the debug and give this message:

"String was not recognized as a valid Boolean."
 

sMax

Client
Регистрация
04.05.2011
Сообщения
132
Благодарностей
49
Баллы
28
mmmmm,

As I understand it to work; zp will take the red exit if it could not run the program for whatever reason.

So if you are sending an exit code from your program, you should always handle the exit code yourself on the branch from the green exit.
If your program fails (exit code undefined) then you would have to handle that in the branch following the red exit, or go to bad end.

"In fact it is possible to work with the problem I described. If you connect "Run program" with "If" through successful exit (and "write exit code" to variable) , result of action is always successful and you can test exicode."
As you already noted.

On my system the pyw doesn't run and the exitCode is -1 which then goes to bad end as expected.
 

sMax

Client
Регистрация
04.05.2011
Сообщения
132
Благодарностей
49
Баллы
28
Another unusual thing with this action (I know you have come across this one yourself as well Thru)
is that you need to create a exit variable even if you don't use the write exit code option or it will
fail in the debug and give this message:

"String was not recognized as a valid Boolean."
I just tested this with several templates that run other programs and I don't get "String was not recognized as a valid Boolean." but I don't use exit codes (for the most part), I mostly use files as job queues and process from there if there is an entry.
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
Any projects with that bug you can send to us to email. I'll check this from Visual Studio to ensure it is fixed.
 

Boxcutter

Client
Регистрация
08.06.2012
Сообщения
127
Благодарностей
72
Баллы
28
On my system the pyw doesn't run and the exitCode is -1 which then goes to bad end as expected.
Yeah I have a fresh install of windows with no python installed yet so the run program actions don't run the scripts
and give a -1. What I thought wasn't correct is that when I removed the bad end it didn't exit via the red dot then even?

-1 and 1 are the same yes/no?

The run program action is certainly not my forte so sorry if this is obvious.

I just tested this with several templates that run other programs and I don't get "String was not recognized as a valid Boolean." but I don't use exit codes (for the most part), I mostly use files as job queues and process from there if there is an entry.
To test this just open up a blank template, add one run program action, fill out the exec path and timeout, save and run the template.

For me it will run the action/file OK but still spits out the debug error occurred window and that message above. If I click 'Write Exit Code'
create a new variable, deselect the 'Write Exit Code' the action runs fine and returns a 0 result.
 

sMax

Client
Регистрация
04.05.2011
Сообщения
132
Благодарностей
49
Баллы
28
What I thought wasn't correct is that when I removed the bad end it didn't exit via the red dot then even?
I don't know how zenno handles the 2 calls after each other (is the time out enough? are the two calls recursive?).

-1 and 1 are the same yes/no?
In C for example, "false" and "true" are 0 and 1, respectively. -1 seems to me to be undefined. More modern versions have a boolean equivalent.


To test this just open up a blank template, add one run program action, fill out the exec path and timeout, save and run the template.

For me it will run the action/file OK but still spits out the debug error occurred window and that message above. If I click 'Write Exit Code'
create a new variable, deselect the 'Write Exit Code' the action runs fine and returns a 0 result.
For me(on my system) this only seems to happen(just tested) if the timeout ends before the program ends. I tested with and without an exit code.
If it keeps on happening for you with a sufficient time out for the program to terminate normally, then it needs to be reported and sorted out.

PS. what I do feel is an error is that if you link all the exits it will always chose the green exit. So there's more here that needs to be checked, reported and fixed.
run error Capture.JPG
 

Boxcutter

Client
Регистрация
08.06.2012
Сообщения
127
Благодарностей
72
Баллы
28
sMax сказал(а):
For me(on my system) this only seems to happen(just tested) if the timeout ends before the program ends. I tested with and without an exit code.
If it keeps on happening for you with a sufficient time out for the program to terminate normally, then it needs to be reported and sorted out.
Yeah your right. I actually want the action to timeout and move to the next step
while the program continues so that's why it always happened to me. I know
the workaround so it's fine. It seems this is the way it's supposed to work in this
case so.
 

txseo

Client
Регистрация
31.05.2013
Сообщения
23
Благодарностей
0
Баллы
1
With RUN PROGRAM, is it possible or practical to execute a program like IBP, give it a set of instructions, execute, and then capture its results?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
You execute external program with command line.
So.. it all depends on the software that you try to execute)
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)