Import statements and multiprocessing

Nicholas Cole nicholas.cole at gmail.com
Tue Jan 30 11:33:34 EST 2018


On Tue, Jan 30, 2018 at 4:23 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Tue, 30 Jan 2018 15:54:30 +0000, Nicholas Cole wrote:

> I would say you're probably misinterpreting the nature of the problem.
> Import * isn't a directive that can be ignored.
>
> Can you show us a *simplified* demonstration? A minimal sample program
> which we can run that demonstrates the issue?

[snip]

I find it extremely odd.

File A:

the multiprocessing code and the map function.

file B: a set of library functions called by the function called in file A.

file C: included in file B by use of a from .C import * statement.


But none of the functions in B can see the objects defined in C unless
an explicit relative import is included in their functions.

In single process code this seems to work perfectly.

Producing a simplified version is not trivial. But I shall see what I
can do.  At any rate, in our current code, the import * directive *is*
ineffective in subprocesses.

N.



More information about the Python-list mailing list