Skip to content

Cannot index dict_items in Python 3 #33

Description

@kwinkunks

OK, I guess this tool is not meant for Python 3. In Python 3, items() on a dictionary must be cast to a list before you can index into it.

Running this:

from PyQt4.QtGui import QApplication
import segyviewlib
qapp = QApplication([])
l = segyviewlib.segyviewwidget.SegyViewWidget(fname)
l.show()

...I get this:

<ipython-input-8-e587dc28b0c1> in <module>()
      2 import segyviewlib
      3 qapp = QApplication([])
----> 4 l = segyviewlib.segyviewwidget.SegyViewWidget(fname)
      5 l.show()

~/anaconda/envs/python36/lib/python3.6/site-packages/segyviewlib-1.1.3.dev2+gc4b38be-py3.6.egg/segyviewlib/segyviewwidget.py in __init__(self, filename, show_toolbar, color_maps, width, height, dpi, segyioargs, parent)
     26         layout = QVBoxLayout()
     27 
---> 28         self._settings_window = SettingsWindow(self._context, self)
     29         self._help_window = HelpWindow(self)
     30 

~/anaconda/envs/python36/lib/python3.6/site-packages/segyviewlib-1.1.3.dev2+gc4b38be-py3.6.egg/segyviewlib/settingswindow.py in __init__(self, context, parent)
    143         self._tree.setColumnWidth(1, 180)
    144 
--> 145         self._build_tree(self._tree, tree_def, self._tree.invisibleRootItem())
    146 
    147         # layout

~/anaconda/envs/python36/lib/python3.6/site-packages/segyviewlib-1.1.3.dev2+gc4b38be-py3.6.egg/segyviewlib/settingswindow.py in _build_tree(self, tree_wdgt, tree_def, root)
    204 
    205     def _build_tree(self, tree_wdgt, tree_def, root):
--> 206         parent, children = tree_def.items()[0]
    207 
    208         # empty label /parent is a special case: either inline with the previous, or skip

TypeError: 'dict_items' object does not support indexing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions