Skip to content

Commit

Permalink
DirectView.sync_imports fixes
Browse files Browse the repository at this point in the history
ImportErrors are properly raised when no such package exists

describe `local` kwarg's purpose, indicating that `local=False`
is not implemented.

closes ipython#1208
  • Loading branch information
minrk committed Apr 6, 2012
1 parent 8a52275 commit 2d2cd9e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions IPython/parallel/client/view.py
Expand Up @@ -405,7 +405,11 @@ def sync_imports(self, local=True):
"""Context Manager for performing simultaneous local and remote imports.
'import x as y' will *not* work. The 'as y' part will simply be ignored.
If `local=True`, then the package will also be imported locally.
Note that remote-only (`local=False`) imports have not been implemented.
>>> with view.sync_imports():
... from numpy import recarray
importing recarray from numpy on engine(s)
Expand Down Expand Up @@ -468,7 +472,9 @@ def view_import(name, globals={}, locals={}, fromlist=[], level=-1):
# enter the block
yield
except ImportError:
if not local:
if local:
raise
else:
# ignore import errors if not doing local imports
pass
finally:
Expand Down

0 comments on commit 2d2cd9e

Please sign in to comment.