[IPython-dev] Confused about ipython.parallel namespaces

MinRK benjaminrk at gmail.com
Tue Mar 4 14:39:18 EST 2014


The remote import is calling 'import that' on each engine. If `that.py` is
not in the CWD of the engines, then it will not be found.


On Tue, Mar 4, 2014 at 11:04 AM, Dinesh Vadhia <dineshvadhia at outlook.com>wrote:

>  Very confused about ipython.parallel namespaces.  Below are two programs
> and the traceback error.  Thanks!
>
> > ipcluster start -n 2
>
> => this.py
>
> from IPython.parallel import Client
>
> def main():
>     that.two_numbers()
>     return
>
> if __name__ == u'__main__':
>
>     rc = Client()
>
>     dview = rc.direct_view()
>     dview.block = True
>
>     with dview.sync_imports():
>         import that
>
>     rc[0].apply(main)
>     rc[1].apply(main)
>
>
> => that.py
>
> def two_numbers():
>     print 1+2
>     return
>
>
> => error traceback
>
> > python this.py
>
> importing that on engine(s)
> Traceback (most recent call last):
>   File "this.py", line 17, in <module>
>     import that
>   File "C:\Anaconda\lib\contextlib.py", line 24, in __exit__
>     self.gen.next()
>   File "C:\Anaconda\lib\site-packages\IPython\parallel\client\view.py",
> line 511, in sync_imports
>     r.get()
>   File
> "C:\Anaconda\lib\site-packages\IPython\parallel\client\asyncresult.py",
> line 126, in get
>     raise self._exception
> IPython.parallel.error.CompositeError: one or more exceptions from call to
> method: remote_import
> [0:apply]: ImportError: No module named that
> [1:apply]: ImportError: No module named that
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140304/d1499474/attachment.html>


More information about the IPython-dev mailing list