python 3.8 초기 설치후 구동시 TypeError발생(미지원 문법 사용?) 정보
python 3.8 초기 설치후 구동시 TypeError발생(미지원 문법 사용?)본문
홈페이지에는 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
아래는 유사하게 작성한 코드인데, 역시 동일한 에러가 발생하네요.
0
댓글 0개