You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------
NameError Traceback (most recent call last)<string> in <module>()
/Users/kmike/envs/pymorphy-33/lib/python3.3/site-packages/ipython-0.14.dev-py3.3.egg/IPython/parallel/client/remotefunction.py in func(f, *sequences)
205 f = lambda f, *sequences: list(map(f, *sequences))
206 else:
--> 207 f = map
208 args = [self.func]+args
209 else:
<ipython-input-3-702776eb8dec> in foo(x)
NameError: global name 'bar' is not defined
The code works if foo doesn't call bar(). It also works if 'bar' is injected to dview manually (via dview['bar'] = bar)
The text was updated successfully, but these errors were encountered:
I believe that's because your engines (separate python processes) don't have the bar function in their namespaces - you only defined it locally. I think this will work if you push the function to the engine namespaces as follows:
Has nothing to do with Python 3, this is just a namespace issue, and it is actually behaving as expected. foo doesn't have a hard reference to bar, it has a reference to whatever __main__.bar is at call time. The __main__ module is the user namespace, but the user namespace on the engine is not generally the same as the user namespace at the client. For this reason, bar can be different when you call foo locally or remotely.
I have the latest master installed; this code doesn't work under Python 3.3 in ipython notebook:
It raises the following exception:
The code works if
foo
doesn't callbar()
. It also works if 'bar' is injected to dview manually (viadview['bar'] = bar
)The text was updated successfully, but these errors were encountered: