Issue 17885: multiprocessing.Process child process imports package instead of parent file (original) (raw)

Issue17885

Created on 2013-05-01 01:28 by hct, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg188197 - (view) Author: HCT (hct) Date: 2013-05-01 01:28
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.
msg188198 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-05-01 01:38
I take it you are on a case insensitive file system, in which case this is just the way imports work in Python: a package is preferred to a .py file with the same name.
History
Date User Action Args
2022-04-11 14:57:45 admin set github: 62085
2013-05-01 01:38:09 r.david.murray set status: open -> closedtype: compile error -> nosy: + r.david.murraymessages: + resolution: not a bugstage: resolved
2013-05-01 01:28:02 hct create