Closed hermit-crab closed 6 years ago
I can't reproduce (i.e., the given example code "just works" for me) with
Server Information:
You are using Jupyter notebook.
The version of the notebook server is: 5.3.1
The server is running on this version of Python:
Python 3.6.4 (default, Dec 23 2017, 19:07:07)
[GCC 7.2.1 20171128]
Current Kernel Information:
Python 3.6.4 (default, Dec 23 2017, 19:07:07)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
I have checked that the extension is loaded (autoimporting works).
Also tried with notebook 5.0.0 which works just as well.
Weird. No idea then. Could be something with my setup. Might check further sometimes if I ever get to it and report back here.
Would be nice to see whether you can reproduce e.g. with jupyter console and/or ipython instead of jupyter notebook; also, do you have any other extensions active?
Yeeep. Happens in both jupyter console and regular ipython. Was absolutely sure I've checked it before reporting but oh well. Have no other extensions defined in config. Global namespace with and without autoimport preloaded also differ:
# globals().keys()
# without
dict_keys(['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtin__', '__builtins__', '_ih', '_oh', '_dh', 'In', 'Out', 'get_ipython', 'exit', 'quit', '_', '__', '___', '_i', '_ii', '_iii', '_i1', 'b', '_i2'])
# with (no variable `b` here which I set with `b = 1`)
dict_keys(['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtin__', '__builtins__', '_ih', '_oh', '_dh', 'In', 'Out', 'get_ipython', 'exit', 'quit', '_', '__', '___'])
Ah. Got it, the issue was fixed at some point between 0.2 (the last release) and master. Can you try installing from git HEAD? I need to cut a new release...
Yep, all good. Thank!
v0.3 released.
Defined functions fail to lookup variables from the global scope.
Commenting out corresponding line in
ipython_config.py
file and restarting notebook process helps.%unload_ext ipython_autoimport
within the notebook does not help.