2026, 새로운 도약을 시작합니다.

python 3.8 초기 설치후 구동시 TypeError발생(미지원 문법 사용?)

· 1년 전 · 428
python_type_error.png

홈페이지에는 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

아래는 유사하게 작성한 코드인데, 역시 동일한 에러가 발생하네요.

1982490798_1729600314.5546.png

첨부파일

python_type_error.png (7.4 KB)
0회 2024-10-22 21:38
|

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

그누보드6 버그

그누보드6 버그를 알려주세요.
번호 제목 글쓴이 날짜 조회
공지 1년 전 조회 726
10 1개월 전 조회 51
9 1개월 전 조회 69
8 3개월 전 조회 119
7 1년 전 조회 429
6 1년 전 조회 368
5 1년 전 조회 522
4 1년 전 조회 651
3 1년 전 조회 477
2 1년 전 조회 412
1 1년 전 조회 843
🐛 버그신고