Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

DirectView.sync_imports fixes

ImportErrors are properly raised when no such package exists

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

closes #1208
  • Loading branch information...
commit bf7d20d3bcf75ca348150bfc9f412f0bb3efb773 1 parent 386ea22
@minrk minrk authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 IPython/parallel/client/view.py
View
10 IPython/parallel/client/view.py
@@ -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)
@@ -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:
Please sign in to comment.
Something went wrong with that request. Please try again.