[issue19946] Have multiprocessing raise ImportError when spawning a process that can't find the "main" module

Brett Cannon report at bugs.python.org
Fri Dec 13 18:29:41 CET 2013


Brett Cannon added the comment:

Multiple questions from Oliver to answer.

> Why has this issue been closed?

Because the decided issue of this bug -- raising AttributeError over ImportError -- was fixed.

> Won't the spawn and forkserver mode work in Python 3.4 for Python program started by a Python script (which is probably the majority of programs written in Python under unix)?

The semantics are not going to change in python 3.4 and will just stay as they were in Python 3.3.

> Is there any reason not to use the `imp.load_source` code I put in my patch as a temporary workaround if the cleaner runpy.run_path solution is too tricky to implement for the Python 3.4 release time frame?

There are two reasons. One is that the imp module is deprecated in Python 3.4 (http://docs.python.org/3.4/library/imp.html#module-imp). Two is that temporarily inserting for a single release a solution that will simply be ripped out in the following release is just asking for trouble. Someone will use the temporary fix in some way in production code and then be shocked when the better solution doesn't work in exactly the same way. It's best to simply wait until 3.5 has the proper solution available.

I know it's frustrating to either name your scripts with a .py until Python 3.5 comes out or just wait until 3.5, but we can't risk a hacky solution for a single release as users will be living with the hack for several years.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19946>
_______________________________________


More information about the Python-bugs-list mailing list