가끔 모델 학습이나 테스트를 진행하다보면

난데없이 'killed'라는 문구만 뜨고 종료될 때가 있다.

 

상당히 당혹스러운데, 찾아보니

sudo dmesg

명령을 통해 로그를 확인할 수 있다.

 

그리고 이런 경우는 대부분 RAM(GPU RAM 아님) 문제라고한다. 

참고로 램 용량은

free 또는 free -m (MB단위) 로 확인할 수 있다.

오류 내용

---------------------------------------------------------------------

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

---------------------------------------------------------------------

 

해결 방법

1. "아나콘다경로/Library/bin/" 경로 열기

2. 다음 네 가지 파일들을 복사

libcrypto-1_1-x64.dll

libcrypto-1_1-x64.pdb

libssl-1_1-x64.dll

libssl-1_1-x64.pdb

3. "아나콘다경로/DLLs/" 경로에 붙여넣기

 

1. 시스템 환경변수 Path에 "아나콘다경로\Library\bin" 추가

 - 그래도 안되면 위에 적었던 해결방법 참조

 

-------

그 밖에

conda install openssl,

이전 버전의 아나콘다 설치,

 conda config --set ssl_verify false

등의 해결책들을 알게 되었지만 나에겐 아무것도 통하지 않았음.

결국 위에 써놓은 방법으로 해결함.

 

zipfile을 이용하면 zip 파일의 압축을 해제할 수 있다.

 

파일이 한글일 경우 깨짐 현상이 발생하는데,

구글링하면 이를 해결한 글을 찾을 수 있다.

http://www.hanbit.co.kr/media/channel/view.html?cms_code=CMS8947142043

 

파이썬을 사용해 한글 파일명을 포함한 ZIP 파일 압축 해제

ZIP 압축과 인터넷 인터넷을 사용하는 인구가 늘면서 많은 사람이 대용량의 파일을 주고 받기 시작했다. 인터넷 이전의 지역적인 통신망이었던 PC 통신에서도 여러 개의 파일을 주고 받기 위해 다양한 압축 유틸리티가 사용되었다. 많은...

www.hanbit.co.kr

 

그런데 python 2.x만 가능하고, python 3.x에는 적용되지 않는다.

python 3.x 관련글을 찾으려 했으나, 아무런 포스팅이 없다.

 

그래서 이래저래 찾아본 결과 해결책을 찾을 수 있었다.

결과적으로

기존 member.filename = member.filename.decode("euc-kr").encode("utf-8")를

member.filename.encode('cp437').decode('euc-kr')로 변경하면 된다.

 

풀 코드는 아래처럼 쓰면 된다.

(참고로 이전 글의 함수에서 dest_path 기능이 없길래 추가했다.)

def unzip(source_file, dest_path):
    with zipfile.ZipFile(source_file, 'r') as zf:
        zipInfo = zf.infolist()
        for member in zipInfo:
            try:
                print(member.filename.encode('cp437').decode('euc-kr', 'ignore'))
                member.filename = member.filename.encode('cp437').decode('euc-kr', 'ignore')
                zf.extract(member, dest_path)
            except:
                print(source_file)
                raise Exception('what?!')

 

하지만 euc-kr로 표현되지 않는 파일명은 여전히 깨지긴한다.

+ Recent posts