Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3754

multiprocessing in subpackage on windows

From Darren Dale <dsdale24@gmail.com>
Newsgroups comp.lang.python
Subject multiprocessing in subpackage on windows
Date Wed, 20 Apr 2011 15:20:31 -0700 (PDT)
Organization http://groups.google.com
Lines 42
Message-ID <ac361c00-48a3-4018-979e-cdae82df4104@c26g2000vbq.googlegroups.com> (permalink)
NNTP-Posting-Host 64.185.155.110
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1303338031 21268 127.0.0.1 (20 Apr 2011 22:20:31 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Wed, 20 Apr 2011 22:20:31 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info c26g2000vbq.googlegroups.com; posting-host=64.185.155.110; posting-account=7xqwcwoAAAAxzXb_jTQleuFWOrnyqg3P
User-Agent G2/1.0
X-HTTP-UserAgent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24,gzip(gfe)
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!feed.ac-versailles.fr!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.kamp.net!newsfeed0.kamp.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!c26g2000vbq.googlegroups.com!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3754

Show key headers only | View raw


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


Thread

multiprocessing in subpackage on windows Darren Dale <dsdale24@gmail.com> - 2011-04-20 15:20 -0700

csiph-web