fixed python and c code to create complex training file