mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
211 stars 123 forks source link

Interfaces working with python3 #20394

Closed peterfpeterson closed 7 years ago

peterfpeterson commented 7 years ago

This is an umbrella issue for fixing Interfaces with python3. The following interfaces don't work for a variety of reasons. Maybe not all of them are python3 related.

Thread 0x00007f319d39e700 (most recent call first): File "", line 2 in

Thread 0x00007f319f596700 (most recent call first): File "/usr/lib64/python3.6/site-packages/zmq/utils/garbage.py", line 47 in run File "/usr/lib64/python3.6/threading.py", line 916 in _bootstrap_inner File "/usr/lib64/python3.6/threading.py", line 884 in _bootstrap

Thread 0x00007f319fdd7700 (most recent call first): File "/usr/lib64/python3.6/site-packages/zmq/sugar/poll.py", line 99 in poll File "/usr/lib64/python3.6/site-packages/zmq/eventloop/ioloop.py", line 122 in poll File "/usr/lib64/python3.6/site-packages/tornado/ioloop.py", line 861 in start File "/usr/lib64/python3.6/site-packages/zmq/eventloop/ioloop.py", line 177 in start File "/usr/lib/python3.6/site-packages/ipykernel/iostream.py", line 72 in _thread_main File "/usr/lib64/python3.6/threading.py", line 864 in run File "/usr/lib64/python3.6/threading.py", line 916 in _bootstrap_inner File "/usr/lib64/python3.6/threading.py", line 884 in _bootstrap

Thread 0x00007f31a182c700 (most recent call first): File "/usr/lib64/python3.6/threading.py", line 295 in wait File "/usr/lib64/python3.6/threading.py", line 551 in wait File "/usr/lib/python3.6/site-packages/IPython/core/history.py", line 834 in run File "/usr/lib/python3.6/site-packages/IPython/core/history.py", line 60 in needs_sqlite File "", line 2 in run File "/usr/lib64/python3.6/threading.py", line 916 in _bootstrap_inner File "/usr/lib64/python3.6/threading.py", line 884 in _bootstrap

Current thread 0x00007f3210a6b940 (most recent call first): bin/launch_mantidplot.sh: line 49: 6999 Aborted (core dumped) LD_PRELOAD=${LOCAL_PRELOAD} TCMALLOC_RELEASE_RATE=${TCM_RELEASE} TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=${TCM_REPORT} LD_LIBRARY_PATH=${LOCAL_LDPATH} QT_API=pyqt $VGLRUN$INSTALLDIR/MantidPlot $*


* [x] `Reflectometry` -> `ISIS Reflectometry OLD` reports

TypeError: addItems(self, Sequence[str]): argument 1 has unexpected type 'dict_keys' at line 9 in '' caused by line 257 in '.../mantid/scripts/Interface/ui/reflectometer/refl_gui.py'


* [x] `SANS` -> `ISIS SANS v2 (experimental)` 

ValueError: The listener ist not of type SettingsDiagnosticTabListener but rather <class 'sans.gui_logic.presenter.settings_diagnostic_presenter.SettingsDiagnosticPresenter.ConcreteSettingsDiagnosticTabListener'> at line 25 in '' caused by line 56 in '.../mantid/scripts/SANS/sans/gui_logic/presenter/main_presenter.py' caused by line 136 in '.../mantid/scripts/SANS/sans/gui_logic/presenter/run_tab_presenter.py' caused by line 69 in '.../mantid/scripts/SANS/sans/gui_logic/presenter/settings_diagnostic_presenter.py' caused by line 57 in '.../mantid/scripts/Interface/ui/sans_isis/settings_diagnostic_tab.py'

peterfpeterson commented 7 years ago

As a start to the issue with Convert to Energy (Direct) here is a patch.

ElliotAOram commented 7 years ago

The above patch works, however on Mantid with either version of python (2.7 or 3). This interface produces an error message box and error in the results log when loading with SNS POWERGEN

KeyError: 'Property with name: bkgd_range is not among the class properties '
  at line 6 in '<Interface>'
  caused by line 202 in 'C:/MantidInstall/scripts/Inelastic\Direct\PropertyManager.py'
  caused by line 255 in 'C:/MantidInstall/scripts/Inelastic\Direct\ReductionHelpers.py'

image

ElliotAOram commented 7 years ago

The Engineering Diffraction interface takes a long time and can become unresponsive when attempting to open it with the Search data archive option checked for file loading. If it is the searching that is taking a long time, this behaviour could be legitimate, but should be the case when a file is searched for, rather than when the interface is opened. I'll create a separate issue for this as it is not related to python 3. EDIT: See issue #20423

ElliotAOram commented 7 years ago

It appears that running .keys() on a list in python 3 produces an object of type dict_keys, in python 2.7 this is a str list. The 2to3 tool doesn't pick this up so we should keep an eye out for this else where

ElliotAOram commented 7 years ago

The ISIS SANS v2 interface was managing to import the same module twice and hence when using isinstance is to validate the listeners class, the Class id did not match as it had been re-imported. The importing took place in the ui code for the data_processor_window.