AMD CPU에서는 잘 돌아가던 프로그램이, Intel CPU에서 실행하니까, 위와 같은 에러가 났다.

 

 

import encodings.idna

위 코드 한줄을 추가하고, 해결하였다.

 

 

참고 : https://stackoverflow.com/questions/9144724/unknown-encoding-idna-in-python-requests

파일을 열려고 하는데, 파일마다 인코딩이 달라서, 계속 에러가 났다.

 

try:
    f = open(fname[0], 'r', encoding="UTF-8")
    self.scr = f.read()
except:
    f = open(fname[0], 'r', encoding="euc-kr")
    self.scr = f.read()

 

그냥 try/except 를 이용해서, 해결했는데, 더 많은 인코딩 방식을 처리할 경우에는 어떻게 해야 할지 아직 생각 안해봤다..

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/resource_tracker.py:203: UserWarning: resource_tracker: There appear to be 2 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

Python에서 쓰레드를 이용하는 코드를 짰는데, 실행해보니, 위와 같은 Warning 이 생기면서 프로그램이 죽었다.

사용한 CPU는 Intel Core2 Duo (2.66Ghz), 구형 CPU다 보니, 쓰레드가 몇개나 있는지 모르겠지만, 4개의 쓰레드만 사용하게 하면 에러가 사라졌다.

 

참고 URL : 

https://discuss.pytorch.org/t/issue-with-multiprocessing-semaphore-tracking/22943

 

Issue with multiprocessing semaphore tracking

Hi I am facing an issue with semaphore tracking while using pytorch multiprocessing over multiple GPUs. I get the following warning message multiple number of times every time and it is slowing down the code execution substantially (8 times slower). /anaco

discuss.pytorch.org

 

'컴퓨터 > Python' 카테고리의 다른 글

[Error] Unknown encoding: idna  (0) 2019.11.14
Encoding UTF-8 / EUC-KR 에러 문제  (0) 2019.11.09

+ Recent posts