problem with simple multiprocessing script on OS X

Darren Dale dsdale24 at gmail.com
Wed Aug 25 15:49:29 CEST 2010


On Aug 24, 5:29 pm, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:
> On Tue, Aug 24, 2010 at 3:31 PM, Darren Dale <dsdal... at gmail.com> wrote:
> > On Aug 23, 9:58 am, Darren Dale <dsdal... at gmail.com> wrote:
> >> The following script runs without problems on Ubuntu and Windows 7.
> >> h5py is a package wrapping the hdf5 library (http://code.google.com/p/
> >> h5py/):
>
> >> from multiprocessing import Pool
> >> import h5py
>
> >> def update(i):
> >>     print i
>
> >> def f(i):
> >>     "hello foo"
> >>     return i*i
>
> >> if __name__ == '__main__':
> >>     pool = Pool()
> >>     for i in range(10):
> >>         pool.apply_async(f, [i], callback=update)
> >>     pool.close()
> >>     pool.join()
>
> >> On OS X 10.6 (tested using python-2.6.5 from MacPorts), I have to
> >> comment out the as-yet unused h5py import, otherwise I get a
> >> traceback:
>
> >> Exception in thread Thread-1:
> >> Traceback (most recent call last):
> >>   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
> >> lib/python2.6/threading.py", line 532, in __bootstrap_inner
> >>     self.run()
> >>   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
> >> lib/python2.6/threading.py", line 484, in run
> >>     self.__target(*self.__args, **self.__kwargs)
> >>   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
> >> lib/python2.6/multiprocessing/pool.py", line 226, in _handle_tasks
> >>     put(task)
> >> PicklingError: Can't pickle <type 'function'>: attribute lookup
> >> __builtin__.function failed
>
> > This is a really critical bug for me, but I'm not sure how to proceed.
> > Can I file a bug report on the python bugtracker if the only code I
> > can come up with to illustrate the problem requires a lame import of a
> > third party module?
> > --
>
> It's working fine for me, OS X 10.6.4, Python 2.6 and h5py from Macports.

Really? With the h5py import uncommented? I just uninstalled and
reinstalled my entire macports python26/py26-numpy/hdf5-18/py26-h5py
stack, and I still see the same error.



More information about the Python-list mailing list