Apr-14-2020, 12:57 PM
(This post was last modified: Apr-14-2020, 12:57 PM by steve_shambles.)
I had the same problem with my Sync-It app this week.
I used "W+" for all the writes and to clear the log, and setting up the log.
I used this to clear the log:
and I didn't need the data any more.
Then I had the problem that clearing it this way (on my Windows computer at least)
it left a lot of "NUL" characters that confused my code when I tried
to read the lines into strings.
To remove these I found a re solution on stackoverflow:
See my GitHub repositories for Sync-It code if you want.
https://github.com/steveshambles?tab=repositories
I'm working on an update at the moment V0.37 with much improved code and a few new features
should be uploading it to GitHub tomorrow sometime.
I used "W+" for all the writes and to clear the log, and setting up the log.
I used this to clear the log:
with open('syncit.log', 'w+'): passI did this on start up and after the log details had been displayed
and I didn't need the data any more.
Then I had the problem that clearing it this way (on my Windows computer at least)
it left a lot of "NUL" characters that confused my code when I tried
to read the lines into strings.
To remove these I found a re solution on stackoverflow:
line = re.sub(r'[\x00-\x1F]+', '', line) # Strip some non ASCII.and all my problems were solved.
See my GitHub repositories for Sync-It code if you want.
https://github.com/steveshambles?tab=repositories
I'm working on an update at the moment V0.37 with much improved code and a few new features
should be uploading it to GitHub tomorrow sometime.