#14367·ipython

Problem with %store

Author: GabrieleBattagliaCreated Mar 11, 2024Updated Sep 29, 2026

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.