Exit in Spaceclaim Script

Erik Kostson
Erik Kostson Member, Moderator, Employee Posts: 285
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited February 2024 in General Language Questions

Trying to exit from a spaceclaim script using sys.exit(), but that does not work (say sample code below gives an error on last line). Does anyone know why and how one can exit a code in spaceclaim.

# Python Script, API Version = V232
import sys
for i in range(10):
    print(i)
    if i == 5:
        print('hi')
        sys.exit()

Comments

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 366
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    Do you mean stop the code processing or close the SC application?

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 285
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited February 2024

    Hi

    So stopping and exiting the python script as described by the sys.exit() definition below - which does not work in SC scripting as mentioned. So we want to stop and exit the SC script, but ofcourse if you try my example in SC script that does not really work.

    'Python's exit function, sys. exit() , is a built-in method used to terminate a Python script. It raises the SystemExit exception which, if not caught, causes the Python interpreter to quit. It's commonly used to manage the termination of Python programs'