본문 바로가기

카테고리 없음

[Error] python multiprocessing Error

The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

        To fix this issue, refer to the "Safe importing of main module

이런 에러가 나는데 .. 

def run_by_batch():
    # 총 239, 400번 호출 
    # 프로세스 4개로 병렬처리 -> 47, 880번
    sys.setrecursionlimit(239400)
    sym_lists = crawling()
    print("++++++++crawling done++++++++")
    with multiprocessing.Pool(4) as process:
       result = process.map(call_kogpt, sym_lists)
       print(list(result))  

if __name__ == "__main__":
    run_by_batch()

if __name__ == "__main__": 

메인함수 넣어주면 해결됨