I am trying to change some variables, based on program arguments.
This is my code:
#initialize all scaling factors to 1
x_scale = 1
y_scale = 1
z_scale = 1
#the second argument is the axis to scale (1-3)
axis_Select = (sys.argv[2])
#the third argument is the scaling factor
scaling_Factor = (sys.argv[3])
if axis_Select == 1:
x_scale = scaling_Factor
elif axis_Select == 2:
y_scale = scaling_Factor
elif axis_Select == 3:
z_scale = scaling_Factor
Then I invoke the program with:
python3 testScript.py /home/user/Desktop/file.extenstion 2 2
Then if i do a print(y_scale)
, it is 1
, instead of 2
that it should be.
This works for other combinations as well, I just used the y_scale
as an example.