[issue17885] multiprocessing.Process child process imports package instead of parent file

HCT report at bugs.python.org
Wed May 1 03:28:02 CEST 2013


New submission from HCT:

created a project with the following content
CODEC/
CODEC/video.py
CODEC/audio.py
CODEC/__init__.py
CRC/
CRC/crc24.py
CRC/crc32.py
CRC/__init__.py
TEST/test_crc.py
TEST/test_codec.py
TEST/__init__.py
__init__.py
test.py
main.py


test.py contain tests that launches multiple multiprocessing.Process to test diffferent module in parallel, but always fail to launch child processes for test with AttributeError. I spent lots of time trying to figure out why my code don't work. I also tried to use the examples from http://docs.python.org/dev/library/multiprocessing.html#the-process-class and they also gives AttributeError when launching child process. in the end, I figured out it's because Pythong file test.py has same name as package TEST. change test.py to test_all.py and everything worked.

It looks multiprocessing import defaults to import package, not the parent file when file name without suffix is same as package.

----------
components: Library (Lib)
messages: 188197
nosy: hct
priority: normal
severity: normal
status: open
title: multiprocessing.Process child process imports package instead of parent file
type: compile error
versions: Python 3.3

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


More information about the Python-bugs-list mailing list