10
API를 호출하는 스크립트가 있습니다. 스크립팅 속도를 높이기 위해 스레딩을 구현하려고했습니다.치명적인 파이썬 오류 : PyImport_GetModuleDict : 모듈 사전이 없습니다.
아래의 스크립트는 IDLE에있을 때 작동하지만 명령 줄에서 sys argv를 사용하여 실행하려고하면 아래에 나열된 두 가지 유형의 오류가 발생합니다.
오류 1
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
This application has requests the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
오류 2
Exception in thread Thread-1 (most likely raised during iterpreter shutdown):
Exception in thread Thread-2 (most likely raised during iterpreter shutdown):
Exception in thread Thread-3 (most likely raised during iterpreter shutdown):
Exception in thread Thread-5 (most likely raised during iterpreter shutdown):
나는 이러한 오류에 아무것도 찾을 수 없습니다. 그래서, 어떤 도움을 주셔서 감사합니다. 아래는 스레딩을 다루는 스크립트 부분입니다.
import threading
import diffbot
urls = [[example.com],[example2.com]]
data = []
def getData(url):
x = diffbot.classify(url)
data.append(x)
def doWork(urls):
for element in urls:
for url in element:
t = threading.Thread(target=getData, args=(url,))
t.daemon = True
t.start()
doWork(urls)
그 첫 번째 오류 메시지를 검색하는 것에서 나는 당신이 Windows에 있다고 추측하고 있습니다. 나는 그 정보를 추가 할 것입니다 (어쩌면 "windows"질문에 태그를 붙이십시오). 또한 diffbot의 대화식 사용 (예 : Python 셸)에서 오류를 발생시키는 경우, 실행중인 Python 버전, 정확히 어떻게 스크립트를 실행하는지, 다른 Python 스크립트가 정상적으로 작동하는지 여부 등을 추가하십시오. –