Insert from keyboard

Hello,
today out of curiosity I tried to insert from keyboard some values using P4C, this is not related with any modelling activity, I just tried to use one basic script that gets a value from keyboard.

n = 0
while n < 1 or n > 9:
    input_user = input("select a number between 1 and 9: ")
    n = int(input_user)

print("number:", n)

This script works as expected in my pycharm editor but when I try to run it in P4C it lets me write a number in the console but after I press “enter” it does not complete the run, it doesn’t go on to the other lines, however at the same time it does not termite the run, it stays still like P4C does not feel the “enter” command.
I do not know why this is happening, there is some capella capability that I have to activate?

Yes the input method is not supported by EASE and Python4Capella. But EASE provides two ways to input values:

  • passing arguments to the script:
#check parameter numbers
if len(argv) != 1:
    # use IFE default values
    aird_path = "/In-Flight Entertainment System/In-Flight Entertainment System.aird"
else:
    # Load the Capella model from the first argument of the script
    aird_path = argv[0]
  • Dialog for input:
def showInputDialog():
    pass

loadModule('/System/UI')

componentName = showInputDialog("Enter the component name:", "New Component 1")