Donders-Institute / bidscoin

BIDScoin converts your source-level neuroimaging data to BIDS
https://bidscoin.readthedocs.io
GNU General Public License v3.0
131 stars 35 forks source link

KeyError: 'bidscoin' using bidscoin in Neurodesk #249

Closed iishiishii closed 2 weeks ago

iishiishii commented 2 weeks ago

Describe the bug I wanted to open the editor GUI for bidscoin 4.4.0 from the terminal but got this error while earlier version works alright:

Creating BIDScoin user configuration:
-> /home/jovyan/.bidscoin/4.4.0/config.toml
-> /home/jovyan/.bidscoin/4.4.0/plugins/dcm2niix2bids.py
-> /home/jovyan/.bidscoin/4.4.0/plugins/spec2nii2bids.py
-> /home/jovyan/.bidscoin/4.4.0/plugins/nibabel2bids.py
-> /home/jovyan/.bidscoin/4.4.0/templates/bidsmap_dccn.yaml
-> /home/jovyan/.bidscoin/4.4.0/templates/bidsmap_bids2bids.yaml
-> /home/jovyan/.bidscoin/4.4.0/templates/bidsmap_sst.yaml
-> /home/jovyan/.bidscoin/4.4.0/templates/schema.json
INFO | 
INFO | -------------- START BIDSeditor ------------
INFO | >>> bidseditor bidsfolder=/home/jovyan/neurodesktop-storage bidsmap=bidsmap.yaml template=/home/jovyan/.bidscoin/4.4.0/templates/bidsmap_dccn.yaml
INFO | Reading: /home/jovyan/.bidscoin/4.4.0/templates/bidsmap_dccn.yaml
INFO | generated new fontManager
INFO | Checking the bidsmap run-items:
INFO | No bidsmap file found: /home/jovyan/neurodesktop-storage/code/bidscoin/bidsmap.yaml
SUCCESS | All datatypes and options in the template bidsmap are valid
Traceback (most recent call last):
  File "/opt/miniconda-latest/bin/bidseditor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/miniconda-latest/lib/python3.12/site-packages/bidscoin/bidseditor.py", line 2036, in main
    raise error
  File "/opt/miniconda-latest/lib/python3.12/site-packages/bidscoin/bidseditor.py", line 2032, in main
    bidseditor(**vars(args))
  File "/opt/miniconda-latest/lib/python3.12/site-packages/bidscoin/bidseditor.py", line 2005, in bidseditor
    if input_bidsmap.options:
       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda-latest/lib/python3.12/site-packages/bidscoin/bids.py", line 1008, in options
    return self._data['Options']['bidscoin']
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'bidscoin'

To reproduce Steps to reproduce the behavior:

  1. Go to Terminal
  2. Run bidseditor neurodesktop-storage/
  3. See error

Expected behavior It should open the main window of the bidseditor.

Software version

Additional context I ran this from Neurodesk.

marcelzwiers commented 2 weeks ago

You are right, it's a bug that happens when you pass a bids folder to the bidseditor that doesn't contain a bidsmap. The bidseditor should (and did in the past) open a file dialogue window, for you to select a bidsmap to edit. I could reproduce this issue with bidscoin 4.4.0, but it happens to be fixed already in the latest development code (see here). And it is a bit of a rare use case (editing a bidsfolder with no bidsmap) that does not hinder regular bidsmapper -> bidseditor workflows. I am therefore closing this issue, but thanks a lot for reporting, it's appreciated!