GUI crashes on Python 2
General
Version: 1.3
The GUI crashes on Python 2 with both PyQt4 and PyQt5.
Traceback
Traceback (most recent call last):
File "[...]/venvs/py2-pyqt4/bin/virtual-ipm-gui", line 11, in <module>
load_entry_point('virtual-ipm', 'gui_scripts', 'virtual-ipm-gui')()
File "[...]/virtual_ipm/start_gui.py", line 39, in main
view = MainWindow()
File "[...]/virtual_ipm/frontends/gui/mainwindow.py", line 182, in __init__
self.main_widget = MainWidget(self)
File "[...]/virtual_ipm/frontends/gui/mainwindow.py", line 44, in __init__
self._load_views()
File "[...]/virtual_ipm/frontends/gui/mainwindow.py", line 51, in _load_views
views.ParticleTracking(self),
File "[...]/virtual_ipm/frontends/gui/views.py", line 205, in __init__
super(ParticleTracking, self).__init__(parent=parent)
File "[...]/virtual_ipm/frontends/gui/views.py", line 155, in __init__
parent=parent
File "[...]/virtual_ipm/frontends/gui/views.py", line 86, in __init__
self._model_view.addWidget(ParametrizedComponentView(model))
File "[...]/anna/frontends/qt/views.py", line 99, in __init__
self._parameter_form = ParameterForm(component.get_parameters())
File "[...]/anna/frontends/qt/forms.py", line 45, in __init__
v_layout.addLayout(self._layout_parameters(nonexpert_parameters))
File "[...]/anna/frontends/qt/forms.py", line 127, in _layout_parameters
input_field = from_type(parameter)
File "[...]/anna/frontends/qt/parameters.py", line 1301, in from_type
return input_cls(potential_wrapper)
File "[...]/anna/frontends/qt/parameters.py", line 381, in __init__
self.unit = self.setup_unit_field(parameter)
File "[...]/anna/frontends/qt/parameters.py", line 451, in setup_unit_field
Unit.dimension(parameter.unit)
File "[...]/anna/input.py", line 24, in wrapper
return method(self_or_cls, other)
File "[...]/anna/input.py", line 310, in dimension
cls._units_per_dimension
File "[...]/anna/input.py", line 309, in <lambda>
lambda d: unit._identifier in cls._units_per_dimension[d],
AttributeError: 'str' object has no attribute '_identifier'
Info / Fix
This is caused by b7dc7841 which removes unicode strings from the particle tracking models file. Hence all strings are of type str
(instead of six.text_type
) which makes a difference on Python 2. This causes an incompatibility with the dependency package anna
because this packages checks for instances of six.text_type
.
The initial unicode incompatibility with NumPy was fixed in version 1.14.1 (see this pull request) so instead of removing unicodes we can just requires 1.14.1 as a minimal NumPy version.