diff options
-rw-r--r-- | lib/commands.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/commands.py b/lib/commands.py index 942bc0e..3df279c 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -88,8 +88,10 @@ class Commands(object): msg = ' '.join(cmd[1:]) #join first word after 'add' to last word try: - with open(co['path'], 'ab') as fout: - fout.seek(1, 1) + with open(co['path'], 'ab+') as fout: + if fout.readline().decode('utf-8') == '': + fout.write(('\n').encode('utf-8')) + fout.write((msg + '\n').encode('utf-8')) print('Ok') |