Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with %store #14367

Open
GabrieleBattaglia opened this issue Mar 11, 2024 · 1 comment
Open

Problem with %store #14367

GabrieleBattaglia opened this issue Mar 11, 2024 · 1 comment

Comments

@GabrieleBattaglia
Copy link

GabrieleBattaglia commented Mar 11, 2024

I do:

In [1]: a=8
In [2]: %store a
C:\Users\GBattaglia\AppData\Local\Programs\Python\Python311\Lib\site-packages\IPython\extensions\storemagic.py:229: UserWarning: This is now an optional IPython functionality, setting autorestore/a requires you to install the `pickleshare` library.
  db[ 'autorestore/' + arg ] = obj
Stored 'a' (int)
In [3]: %store
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 get_ipython().run_line_magic('store', '')
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\IPython\core\interactiveshell.py:2480, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
   2478     kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2479 with self.builtin_trap:
-> 2480     result = fn(*args, **kwargs)
   2482 # The code below prevents the output from being displayed
   2483 # when using magics with decorator @output_can_be_silenced
   2484 # when the last Python token in the expression is a ';'.
   2485 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\IPython\extensions\storemagic.py:161, in StoreMagics.store(self, parameter_s) 
    159 # run without arguments -> list variables & values
    160 elif not args:
--> 161     vars = db.keys('autorestore/*')
    162     vars.sort()
    163     if vars:
AttributeError: 'PickleShareDB' object has no attribute 'keys'
In [4]:

Is it something goes wrong on my configuration or an ipython issue? Thanks.

@Carreau
Copy link
Member

Carreau commented Mar 18, 2024

I think this has been fixed in newer version of IPython.

You can either update ipython, or pip install pickleshare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants