seirov
Python syntax is indentation sensitive. Take a look at the script and you will be familiar with that soon. For the line which raised the error message in your case the simplest way is to edit the original line with adding ASTERSTUDY to it while keeping anything else unchanged. I am using SALOME 9.12 and that line is line number 97. I changed it from
context.setVariable(r"SALOME_MODULES", r"SHAPER,SHAPERSTUDY,GEOM,SMESH,PARAVIS,YACS,JOBMANAGER", overwrite=True)
to
context.setVariable(r"SALOME_MODULES", r"SHAPER,SHAPERSTUDY,GEOM,SMESH,ASTERSTUDY,PARAVIS,YACS,JOBMANAGER", overwrite=True)
When it comes to #[ASTER_STUDY] section I put it just after #[YDEFX] section. Taking a look at #[YDEFX] section (or any other sections) you will be familiar with how to keep the right indentation soon.
ASTERSTUDY_SRC_DIR doesn't matter and you can delete it from the code.