diff options
Diffstat (limited to '')
| -rw-r--r-- | taskipy/pyproject.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/taskipy/pyproject.py b/taskipy/pyproject.py index 74e7624..f58e9a4 100644 --- a/taskipy/pyproject.py +++ b/taskipy/pyproject.py @@ -1,7 +1,10 @@ from pathlib import Path from typing import Any, Dict, MutableMapping, Optional, Union -import tomli +try: + import tomllib +except ImportError: + import tomli as tomllib from taskipy.exceptions import ( InvalidRunnerTypeError, @@ -92,10 +95,10 @@ class PyProject: file_path = Path(file_path).resolve() with open(file_path, 'rb') as file: - return tomli.load(file) + return tomllib.load(file) except FileNotFoundError: raise MissingPyProjectFileError() - except tomli.TOMLDecodeError as e: + except tomllib.TOMLDecodeError as e: raise MalformedPyProjectError(reason=str(e)) @staticmethod |