Fail saving a namedtuple by Pickle


Javi Domínguez
 

Hello.

Does anyone know why this error occurs? Nothing happens, I easily fix it by converting it to normal list before saving but i would like to understand the cause of the failure.

NavKeys = collections.namedtuple("NavigationKeys", ("nextOption", "previousOption", "nextItem", "previousItem"))
self.navKeys = NavKeys("kb:rightArrow", "kb:leftArrow", "kb:downArrow", "kb:upArrow")
ERROR - unhandled exception (17:10:15.027) - MainThread (10756):
Traceback (most recent call last):
  File "gui\settingsDialogs.pyc", line 623, in onOk
  File "gui\settingsDialogs.pyc", line 617, in _doSave
  File "C:\Users\Javichi\AppData\Roaming\nvda\addons\easyNavigation\globalPlugins\easyNavigation\__init__.py", line 216, in onSave
    easyNavigationRing.save()
  File "C:\Users\Javichi\AppData\Roaming\nvda\addons\easyNavigation\globalPlugins\easyNavigation\__init__.py", line 86, in save
    pickle.dump((ring, self.defaultActive, self.navKeys), f, 0)
_pickle.PicklingError: Can't pickle <class 'globalPlugins.easyNavigation.NavigationKeys'>: attribute lookup NavigationKeys on globalPlugins.easyNavigation failed
Thanks

Javi Dominguez

Join nvda-addons@nvda-addons.groups.io to automatically receive all group messages.