ISISComputingGroup / IBEX

Top level repository for IBEX stories
4 stars 2 forks source link

genie_python: python startup error #8382

Closed FreddieAkeroyd closed 1 week ago

FreddieAkeroyd commented 3 weeks ago

If running python from genie_python.bat directly on an instrument (but not if running python in GUI scripting window) you get the error

IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help.
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 1
----> 1 ip.Completer.matchers.remove(ip.Completer.magic_matches)

ValueError: list.remove(x): x not in list
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 1
----> 1 ip.Completer.matchers.remove(ip.Completer.file_matches)

ValueError: list.remove(x): x not in list

This is due to https://github.com/ISISComputingGroup/genie_python/blob/3a1669bdb7fd498eaf635a5fa7da6984421f81d3/package_builder/ipython_config.py#L35 - it seems the functions we are trying to remove from the list have been deprecated since ipython version 8.6 (October 2022)

It may or may not happen on a developer computer - this is because the modified ipython config is only installed by a kits$ built python, so if you have never installed this version locally (i.e. just used dev_build_python) then you will likely not have this file

Acceptance criteria

To Test

updated dev_build_python will now copy new ipython_config.py to %PROFILEDEFAULT%\.ipython\profile_default - if your genie_python.bat does not currently error and you wish to see the error before updating, copy the original ipython_config.py to above place