Skip to content

Commit 1bf665f

Browse files
Updated according to comment on issue #2
1 parent d7221a0 commit 1bf665f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/hermes_toml/harvest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pathlib
55
import toml
66

7+
from contextlib import chdir
78
from email.utils import getaddresses
89
from pydantic import BaseModel
910

@@ -39,14 +40,14 @@ def __call__(self, command: HermesHarvestCommand):
3940
path = command.args.path
4041
old_path = pathlib.Path.cwd()
4142
if path != old_path:
42-
os.chdir(path)
43+
chdir(path)
4344

4445
#harvesting the data from the .toml file specified in the Settings class
4546
data = self.read_from_toml(command.settings.toml.filename)
4647

4748
#resetting the working directory
4849
if path != old_path:
49-
os.chdir(old_path)
50+
chdir(old_path)
5051

5152
#returning the harvested data and some metadata
5253
return data, {"filename": command.settings.toml.filename}

0 commit comments

Comments
 (0)