홈페이지에는 3.8 이상 파이썬 지원으로 표시되었습니다만.
아래 코드중 str | Path 부분 문법을 python 3.8.20에서 지원 못 하나 봅니다.
g6/lib/slowapi/__init__.py 소스 발췌
class CustomConfig(Config):
""".env 파일을 utf-8로 읽기 위한 CustomConfig 클래스"""
def _read_file(self, file_name: str | Path) -> dict[str, str]:
file_values: dict[str, str] = {}
with open(file_name, encoding="utf-8") as input_file:
for line in input_file.readlines():
line = line.strip()
if "=" in line and not line.startswith("#"):
key, value = line.split("=", 1)
key = key.strip()
value = value.strip().strip("\"'")
file_values[key] = value
return file_values
아래는 유사하게 작성한 코드인데, 역시 동일한 에러가 발생하네요.

게시글 목록
| 번호 | 제목 |
|---|---|
| 16 | |
| 15 | |
| 14 | |
| 10 | |
| 9 | |
| 7 | |
| 6 | |
| 2 | |
| 1 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기