Describe the bug
When using clinica convert adni-to-bids clinica crashes. The error is related to a file format issue.
The output of the command is the following:
`Creating participants.tsv...
*** Clinica crashed ***
Exception type: XLRDError
Exception value: Excel xlsx file; not supported
Below are displayed information that were gathered when Clinica crashed. This will help to understand what happened if you transfer those information to the Clinica development team.
============================================================================================================================================================
0 /home/itsasne/miniconda3/envs/clinicaEnv/bin/clinica 33 sys.exit(load_entry_point('clinica==0.3.7', 'console_scripts', 'clinica')())
1 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/cmdline.py 536 execute args.func(args)
2 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids_cli.py 56 run_command self.absolute_path(args.bids_directory))
3 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py 62 convert_clinical_data participants_df = bids.create_participants_df('ADNI', clinic_specs_path, clinical_data_dir, bids_ids)
4 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/iotools/bids_utils.py 38 create_participants_df participants_specs = pd.read_excel(clinical_spec_path, sheet_name='participant.tsv')
5 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/util/_decorators.py 296 wrapper return func(*args, **kwargs)
6 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_base.py 304 read_excel io = ExcelFile(io, engine=engine)
7 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_base.py 867
init self._reader = self._engines
engine8 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py 22
init super().
init(filepath_or_buffer)
9 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_base.py 353
init self.book = self.load_workbook(filepath_or_buffer)
10 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py 37 load_workbook return open_workbook(filepath_or_buffer)
11 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/xlrd/
init.py 170 open_workbook raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
Documentation can be found here: http://www.clinica.run/doc/
If you need support, do not hesitate to ask: https://groups.google.com/forum/#!forum/clinica-user
Alternatively, you can also open an issue on GitHub: https://github.com/aramis-lab/clinica/issues`
The error occurs in "/home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/xlrd/init.py", because in line 170 this condition is not fulfilled:
if file_format and file_format != 'xls': raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
The "file format" variable is obtained from a function (inspect_format) which is located in the same script. However, this function returns "xlsx" as the format_file, instead of "xls", which causes posterior errors.
In order to get 'file_format = 'xls'', this condition must be fulfilled (and it does not):
if peek.startswith(XLS_SIGNATURE): return 'xls'
To Reproduce
Steps to reproduce the behavior:
- Install clinica
- Launch the converter
clinica convert adni-to-bids usage: clinica convert adni-to-bids \dataset_directory \clinical_data_directory \bids_directory - See error
Expected behavior
Correct conversion from adni to bids.
Desktop (please complete the following information):
- OS: Ubuntu 64 bits (runned in Oracle VM)
- Terminal