import mimetypes import threading import time old_init = mimetypes.init def work(): print (mimetypes.guess_type("hglogo.png")) def main(): threads = [] for i in range(20): threads.append(threading.Thread(target=work)) for t in threads: t.start() for t in threads: t.join() main()