Skip to content

Commit c1c9ace

Browse files
committed
fix not existing file not handled
1 parent 94ba261 commit c1c9ace

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/somesy/pyproject/writer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def save(self, path: Optional[Path] = None) -> None:
6565
"""Save the pyproject file."""
6666
path = path or self.path
6767

68+
if not path.is_file():
69+
with open(path, "w") as f:
70+
tomlkit.dump(self._data, f)
71+
return
72+
6873
with open(path, "r") as f:
6974
# tomlkit formatting sometimes creates empty lines, dont change if context is not changed
7075
existing_data = f.read()

0 commit comments

Comments
 (0)