The problem was spotted by horuable right away.and the result after two runsThe python and micropython file.write is the same. https://www.w3schools.com/python/ref_file_write.asp
I guess the problem is with this line:
Code: Select all
file.write(test1_string,' ')
Code:
testfile = "a.dat"test1_string="0123456789"try: with open(testfile, 'a') as file: # write string + new line r = file.write(test1_string+'\n') print("bytes written", r)except Exception as e: print(e) print("\n--- Read file ---",testfile,"\n")print(open(testfile).read())Code:
>>> %Run -c $EDITOR_CONTENTbytes written 11--- Read file --- a.dat 01234567890123456789>>> Statistics: Posted by danjperron — Tue Apr 01, 2025 2:43 pm