Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions adafruit_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

"""

import errno
import os
import sys
import time
Expand Down Expand Up @@ -387,7 +388,7 @@ def doRollover(self) -> None:
# Rename the current file to the next number in the sequence.
os.rename(CurrentFileName, CurrentFileNamePlus)
except OSError as e:
if e.args[0] == 2:
if e.errno == errno.ENOENT:
# File does not exsist. This is okay.
pass
else:
Expand All @@ -405,7 +406,7 @@ def GetLogSize(self) -> int | None:
self.stream.flush() # We need to call this or the file size is always zero.
LogFileSize = os.stat(self._LogFileName)[6]
except OSError as e:
if e.args[0] == 2:
if e.errno == errno.ENOENT:
# Log file does not exsist. This is okay.
LogFileSize = None
else:
Expand Down
Loading