planetarypy / pvl

Python implementation of PVL (Parameter Value Language)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

items is not subscriptable in python3

percurnicus opened this issue · comments

As pointed out in #23, in python3 items() returns an ItemsView object which is not subscriptable

In [1]: import pvl

In [2]: label = pvl.loads("""
   ...:     foo = bar
   ...:     monty = python
   ...: """)

In [3]: items = label.items()

In [4]: items[0]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-95f461411437> in <module>()
----> 1 items[0]

TypeError: 'ItemsView' object does not support indexing

But we should get something similar to:

In [4]: items[0]
Out [4]: ('foo', 'bar')