On Fri, Feb 21, 2020 at 2:37 AM Geoff Bache <geoff.ba...@gmail.com> wrote: > When several threads execute this simultaneously I often get a stacktrace > saying some function near the end of module b is not defined, presumably > because the module has been imported part-initialised. > This only seems to happen when my Python modules are packaged in a zip > file, not when they are ordinary files on disk. > > I have observed this in both Python 3.7 and Python 3.8. Does anyone have > any insights or suggestions for how to debug this? It seems likely to be > hard to produce a reproducible test case.
One easy way to probe the bug would be to pre-import the module before starting any secondary threads. If you ever get the problem under that pattern, then it's not a concurrency problem (IOW have fun figuring out what *is* the problem). Another thing to try: Slap a print call at the top and bottom of the module. See if you get multiple of them. ChrisA -- https://mail.python.org/mailman/listinfo/python-list