Python doubt: sys.argv

What exactly does sys.argv[1] and sys.argv[2] does in the Python Program {U2.2.1.py}: model1_to_model2_listener.py? Is it necessary to use it in this situation?

Hi Apurva,
the sys.argvcaptures parameters provided to the Python program, that the person that launches the program may want to provide.
The sys.argv[1] means the first parameter, and the sys.argv[2] means a second parameter. This means, that the Python program is expecting and capturing two parameters from the person who launches it.

For that specific program, it is completely mandatory to use it, because the program is created to allow the decision of which model has to follow which model. The first parameter is the follower and the second is the followed.

1 Like

Understood! But I observed that it doesn’t matter whatever arguments I put in sys.arg when doing the fixed_frame or moving_frame exercise because it reaches the final destination anyhow. Is that correct?