I’m struggling with the order in which sofistik is reading teddy files when I use python to generate dat files automatically.
I have made this tiny example file to show the issue:
Sofistik file:
+prog template urs:1 $ TASK 1
<TEXT,FILE=from_sofi.dat>
10
</TEXT>
END
! TASK 2
+sys python test.py
+prog template urs:2 $ TASK3
#include from_py.dat
prt#from_py
END
The python file multiplies the output from sofistik and writes it to a dat file from_py.dat
which I then want Sofistik to read again
Python file:
sofi = float(open('from_sofi.dat').read())*5
with open('from_py.dat','w') as f:
f.write(f'let#from_py {sofi}')
The idea is that the Sofistik file should perform the tasks line by line, i.e.:
- Write output file
from_sofi.dat
- Run python file
test.py
- Read input file
from_py.dat
However, as I have come to understand Sofistik starts by scanning for #include
tags and attempts to include these files which haven’t been generated yet.
As such, I have to manually run each of the three tasks in order to force sofistik to read the file in a proper order.
Is there a way to force sofistik to read the file line by line?
PS:
If there already is a from_py.dat
file present in the working directory, it does run, but as it reads the #include
before it runs task1, any changes I make in task1 is not included in task3 unless I run everything manually.