diff --git a/hmrc/auth/token.py b/hmrc/auth/token.py index 6ce0f90..04a665a 100644 --- a/hmrc/auth/token.py +++ b/hmrc/auth/token.py @@ -65,9 +65,10 @@ def __post_init__(self, path): # Open/create file if no explicit file was provided if self.file is None: - if path is None: - path = os.path.expanduser('~/.hmrc.token') - fd = os.open(path, (os.O_RDWR | os.O_CREAT), + self.path = path + if self.path is None: + self.path = os.path.expanduser('~/.hmrc.token') + fd = os.open(self.path, (os.O_RDWR | os.O_CREAT), (stat.S_IRUSR | stat.S_IWUSR)) self.file = open(fd, 'a+t', encoding='utf8')