Python/Django(23)
-
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf9 in position 15: invalid start byte
에러 상황 pandas 로 csv 생성 후 다운로드 시 UnicodeDecodeError 발생 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf9 in position 15: invalid start byte 해결방법 Open 시 encoding 지정 file = open(path, 'rb', encoding='UTF8')
2022.11.30 -
LookupError: unknown encoding: x-windows-949
ErrorFatal Python error: init_stdio_encoding: failed to get the Python codec name of the stdio encodingPython runtime state: core initializedLookupError: unknown encoding: x-windows-949윈도우가 기본으로 949로 셋팅되어 있어서 생기는 이슈 Trouble ShootingFile > Settings > File Encodings > Project Encoding > UTF-8 위의 방법으로 해결 안될 시 확인사항가상환경 확인python 가상환경이 로컬로 되어있을 수 있음. debug 시 script path 확인
2022.11.28 -
Django request_cache 이슈 해결방법
Django 포르젝트에서 request_cache 에러 발생 시 해결방안입니다.해결 방안 프로젝트 디렉토리에서 진행cd _request_cachegit clean -dfgit checkout -- .
2022.11.07 -
PyCharm plugin
1. One Dark theme 2. key promoter x 마우스로 버튼을 눌렀을 때, 해당 기능의 키보드 단축키를 알려준다. 3. Rainbow Brackets 괄호 기호에 색을 부여해서 구별하기 쉽게 도와준다. 4. Grep Console 콘솔 창 텍스트에 컬러를 입히거나, 필터(정규표현식)을 적용해 원하는 로그만 볼 수 있다. 5. GitToolbox Annotate with Git Blame 으로 필요할 때 보는게 더 보기 좋음 해당 라인을 누가 커밋했는지 볼 수 있다. 6. Quick File Preview 해당 파일을 잠깐 보고 싶을 때, 클릭 한번으로 띄워준다. 7. sonar lint 소스 정적 분석 도구(오픈소스) 8. Awesome Console 콘솔창에 이동가능한 경로(파일, 클..
2022.07.06 -
Codecov 동작 테스트
Codecov를 사용중이나 로컬에서의 테스트결과와 차이가 있음. 해당 테스트에 절차를 작성했습니다. Local Check1. coverage 설치pip install coverage 2. test 실행coverage run -m pytest arg1 arg2 arg3 3. 결과값 확인Local에서의 결과 값과 개발환경에서의 결과값이 다름.# commendcoverage run -m pytet 테스트.py# htmlcoverage html 추가적인 방법(https://pytest-cov.readthedocs.io/en/latest/reporting.html)pytest {test directory} --cov=. --cov-report=htmlopen ./htmlcov/index.html
2022.06.27 -
python manage.py shell Error(ImportError: dlopen(~))
에러 상황 아래와 같은 에러가 발생하면서 shell 접속이 되지 않는 상황 발생 1. ImportError: dlopen( ~~~~, 0x0002) 의 ~~~~.so 라이브러리 경로 복사 후 otool -L "" 2. Architecture 확인(arm) #Architecture 확인 lipo -info /usr/local/lib/libmecab.dylib 3. 경로변경 #경로 변경 install_name_tool -change /usr/lib/libmecab.dylib /usr/local/lib/libmecab.dylib "" #install 경로 변경 확인 otool -L ""
2022.06.09 -
cannot import name 'six' from 'django.utils'
Error Django를 3.대로 올리면서 six가 없어졌는데 다른 모듈에서는 사용 중이여서 생기는 이슈이다. Trouble Shooting 사용 중이던 모듈의 버전을 올린다. Issue (해당 이슈는 로컬 세팅에서 나타나는 이슈, 컨테이너환경은 환경세팅이 새로 되서 이슈가 없음) requirement.txt 수정(버전 업) 후 pip install -r requirements.txt를 했으나 버전이 그대로 남음. unistall 후 진행하면 맞게 설치됨 기존 버전(낮은 버전) 이 install 되어 있는 상황에서 requirements에
2022.06.08