About catching ANY exception
How can I write a try/ except block that catches all exceptions? You can but you probably shouldn't: try: do_something() except: print "Caught it!" However, this will also catch exceptions like KeyboardInterrupt and you usually don't want that, do you?
https://stackoverflow.com/questions/4990718/about-catching-any-exception
catch all exception

뭔가이상하더니 result count 디렉토리만 세는코드 잘못함
recolor_count = len([d for d in os.listdir(recolor_path) if os.path.isdir(f"{recolor_path}\\{d}")])
이건데
recolor_count = len([d for d in os.listdir(recolor_path) if os.path.isdir(d)])
이렇게하면 폴더명을 현재디렉토리에서 찾아서 문제

자꾸 에러나던데 그냥 이미지 개수가 이상함


1어이가 없군.. 미루기만 하고
telebot 통계개선

이게 중심
# Time ost timecost = time() - start_time mtimecost.ALL.append(timecost) print("--- %s seconds ---" % (timecost))
all 만 추가

def utf8_imread(filePath): stream = open(filePath.encode("utf-8"), "rb") bytes = bytearray(stream.read()) numpyArray = np.asarray(bytes, dtype=np.uint8) return cv2.imdecode(numpyArray, cv2.IMREAD_UNCHANGED)
def im_save_cv2(filename, image, jpg_quality=100): print(f"\n{filename}\n") file_checkExist_delete(filename) imwrite(filename, image, [int(cv2.IMWRITE_JPEG_QUALITY), jpg_quality])
한글 경로를 못읽어서 none으로 imread해서 그렇다
바꿔주는 함수 찾음 다 그런듯 utf8 cv2 python이 처리못해서..
imread, imwrite 에서 한글(유니코드)로 인한 문제를 해결하자
python에서 opencv를 사용하면서 한글(유니코드)로 인한 문제가 발생 할 경우가 있다. python의 opencv에서는 유니코드를 처리하지 못하기 때문에 발생하는 문제라고 한다. 이러한 경우 아래와 같이 imencode 함수..
https://jangjy.tistory.com/337

[Python] OpenCV를 이용한 imread중 image 한글파일 경로 입력시 문제와 해결방안.
Python 1년차개발신입생 2018. 11. 29. 16:35 저는 Mac OS OpenCV와 python 개발 환경에서 영상 프로그래밍 개발을 하고있습니다 . MacOS에서 작업을 끝내고 해당 윈도우 OS가 올라가 있는 랩탑에서 확인하는 도중 에러가 발생하여 확인해보니 한글이 포함된 파일경로에 대한 이미지 파일을 읽지 못하여 발생하는 에러였습니다.
https://zzdd1558.tistory.com/228
![[Python] OpenCV를 이용한 imread중 image 한글파일 경로 입력시 문제와 해결방안.](https://t1.daumcdn.net/tistory_admin/static/images/openGraph/opengraph.png)
- 이건 폴더 전체 지우는 강제로 안에 있어도
stackoverflow.com
https://stackoverflow.com/questions/303200/how-do-i-remove-delete-a-folder-that-is-not-empty
journey_folders = os.listdir(PATH) for journey_name in journey_folders: # Filter if not os.path.isdir(f"{PATH}\\{journey_name}"): continue if "삭제" in journey_name: continue journey_name_path = f"{PATH}\\{journey_name}" if "지울" in journey_name_path: continue print_head(journey_name_path) project_contents = os.listdir(journey_name_path) for contents in project_contents: # Init And Filter if "삭제" in contents: continue round_name_path = journey_name_path + '\\' + contents if not os.path.isdir(round_name_path): continue elif "INS" in round_name_path: continue result_path = round_name_path + '\\blurResult\\result' print(result_path) shutil.rmtree(result_path, ignore_errors=True)

Seonglae Cho