Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3754
| From | Darren Dale <dsdale24@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | multiprocessing in subpackage on windows |
| Date | 2011-04-20 15:20 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <ac361c00-48a3-4018-979e-cdae82df4104@c26g2000vbq.googlegroups.com> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar
multiprocessing in subpackage on windows Darren Dale <dsdale24@gmail.com> - 2011-04-20 15:20 -0700
csiph-web