Problems with imports on multiple threads, with embedded Python

geoff.bache at gmail.com geoff.bache at gmail.com
Wed Dec 20 11:13:02 EST 2017


Hi all,

I have a multithreaded application using an embedded Python 3.6.4 (upgraded from 3.6.2 today in the hope that the problem was now solved: it doesn't seem to be). The standard library is in a zip file. So long as only one thread is running Python at a time it seems to work fine. But there seems to be a problem with the module importing when several Python threads are active.

I get a variety of errors indeterministically, usually indicating that some symbol hasn't been imported. This occurs both in my own code and in the standard library. The most frequent is probably this line:

dt = datetime.strptime(dtStr, fromFmt)

which produces

AttributeError: module '_strptime' has no attribute '_strptime_datetime' 

at random.

Does anyone have any insight into this problem?

Regards,
Geoff Bache



More information about the Python-list mailing list