valosekj / fsleyes_preset

Run FSLeyes and automatically set display options
GNU General Public License v3.0
0 stars 0 forks source link

Limit fsleyes warnings/errors printed into CLI #23

Open valosekj opened 2 years ago

valosekj commented 2 years ago

Some versions of fsleyes output a lot of warnings/errors into the terminal, e.g.:

$ valosek@chatham:/home/user/sub-001/anat$ ff t1w.nii.gz
Executing: /usr/local/fsleyes-1.3.3.env/bin/fsleyes  t1w.nii.gz -dr 0 1150.0
  File "/usr/local/fsleyes-1.3.3.env/lib/python3.10/site-packages/wx/lib/stattext.py", line 306, in OnPaint
    dc.DrawText(line, x, y)
TypeError: DC.DrawText(): arguments did not match any overloaded call:
  overload 1: argument 2 has unexpected type 'float'
  overload 2: argument 2 has unexpected type 'float'
Traceback (most recent call last):
  File "/usr/local/fsleyes-1.3.3.env/lib/python3.10/site-packages/wx/lib/stattext.py", line 306, in OnPaint
    dc.DrawText(line, x, y)
TypeError: DC.DrawText(): arguments did not match any overloaded call:
  overload 1: argument 2 has unexpected type 'float'
  overload 2: argument 2 has unexpected type 'float'
Traceback (most recent call last):
  File "/usr/local/fsleyes-1.3.3.env/lib/python3.10/site-packages/wx/lib/stattext.py", line 306, in OnPaint
    dc.DrawText(line, x, y)
...

Temporary workaround is modification of ff alias in rc file like this:

#alias ff='fsleyes_preset &> /dev/null'
alias ff='fsleyes_preset'

However, after this fix, ff does not output anything into the terminal. It means that even built-in errors are not printed: https://github.com/valosekj/fsleyes_preset/blob/ea8198fc5965d24c4c119445f3a69482ef7cd5b6/fsleyes_preset.py#L179

TODO - find a better workaround