Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Preferred way to stop a program call instruction

#1
Hello,

There seems to be different ways to exit a Python script.  If a Python script is used as a "Program Call Instruction" and it needs to exit...

  1. Which way will work best for RoboDK?  sys.exit(), quit(), exit(), etc...  
  2. How can the Python script exit with an error that will stop the program from continuing?

   

Thank you for your help.
#2
All exit options you menationed are the same from RoboDK's point of view.

If you want the program to stop you can write a script before exiting. For example:
Code:
programs = RDK.ItemList(ITEM_TYPE_PROGRAM)
for prog in programs:
    prog.Stop()

quit(0)
#3
Thank you Albert - that solution should work.

I have a related question as I am trying to make this process work.  The image below shows that there are several instructions in the program that call a Python script.  Those scripts call another "common" one that will act as a client.  The problem is that the "Inline Call" script does not wait for the "Client" script to return.  In other words, the 

returnCode = RDK.RunCode("Client", True)

is not blocking.  How can it "RunCode" and have it wait for a return?

   
  




Users browsing this thread:
1 Guest(s)