Django

FileNotFoundError: [Errno 2] No such file or directory 에러 바로 해결

새우하이 2022. 3. 31. 23:49

따로 설정되어있는 작업경로를 기준으로 파일을 찾기 때문에 파일을 못찾는 경우입니다.

scriptpath = os.path.dirname(__file__)
filename = os.path.join(scriptpath, '파일명')

with open(filename) as json_file:
	json_data = json.load(json_file)

해주면 끝