[IPython-dev] Confused about ipython.parallel namespaces

Dinesh Vadhia dineshvadhia at outlook.com
Tue Mar 4 14:04:18 EST 2014


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140304/9eb103bb/attachment.html>


More information about the IPython-dev mailing list