multiprocessing in subpackage on windows

D

Darren Dale

I have two really simple scripts:

C:\Python27\Scripts\foo
---
if __name__ == '__main__':
import bar
bar.main()

C:\Python27\Lib\site-packages\bar.py
---
from multiprocessing import Pool

def task(arg):
return arg

def main():
pool = Pool()
res = pool.apply_async(task, (3.14,))

print res.get()

if __name__ == '__main__':
main()


If I run "python C:\[...]bar.py", 3.14 is printed. If I run "python C:\
[...]foo", I get a long string of identical errors:

File "<string>", line 1 in <module>
File "C:\Python27\lib\multiprocessing\forking.py", line 346, in main
prepare(preparation_data)
File "C:\Python27\lib\multiprocessing\forking.py", line 455, in
prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named foo


This same scheme works on Linux. What step have I missed to allow a
script to run code from a subpackage that uses multiprocessing?

Thanks,
Darren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top