Posts: 8
Joined: Nov 2015
Reputation:
1
2015-12-01, 16:40
(This post was last modified: 2015-12-03, 14:38 by 1alpha.)
How can I make an Ordered Dictionary, is there a class I can import
"from collections import OrderedDict" doesn't seem to work with the python version used by Kodi,
are there any work around's.
Any ideas
Thanks
Posts: 1,662
Joined: Jun 2011
Reputation:
119
2015-12-01, 17:10
(This post was last modified: 2015-12-01, 17:11 by Roman_V_M.)
OrderedDict was added to the Standard Library in Python 2.7, while Kodi for some platforms uses Python 2.6. Download ordereddict module from the pip repository and add it to your plugin.
Posts: 8
Joined: Nov 2015
Reputation:
1
I downloaded ordereddict-1.1.tar.gz and put ordereddict.py in the root of the addon
import sys
import os
import OrderedDict
No error with import OrderedDict when run on Kodi
but when I add this
d = OrderedDict([('key1', 'value1'), ('key2', 'value2')])
I get an error.
I guess I'm not sure if I'm adding pip repository addordereddict module correctly,
Thanks
Posts: 7,648
Joined: Jun 2011
Reputation:
287
we will bump python to 2.7 across the board at the start of the v17 cycle, so ordered dict will be available soon.
Posts: 296
Joined: Nov 2014
Reputation:
10
Yeah, it's really great to hear!