moabb
moabb copied to clipboard
Downloading problem for datasets Huebner2017 and Huebner2018
Hi, I tried to use the Huebner datasets for my research but when downloading them, I get the following error for both of them :
File "C:\Program Files\Python39\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "\\filesrv4\home$\bleuzea\.windows\Application Data\Python\Python39\site-packages\moabb\datasets\base.py", line 169, in download
self.data_path(
File "\\filesrv4\home$\bleuzea\.windows\Application Data\Python\Python39\site-packages\moabb\datasets\huebner_llp.py", line 97, in data_path
zipfile_path = glob.glob(
IndexError: list index out of range
It seems to be linked to the unzipping of the subject file because the zip file of the given subject has been downloaded well and if I unzip it correctly at the right place, the data can be used normally.
If you want to get the error, just delete the data you have for this base and enter :
from moabb.datasets import Huebner2017
Huebner2017().download()
and you should get it. It also works for Huebner2018 in the same way.
Ok the error was actually well here. In file "moabb\datasets\huebner_llp.py" at the line 97, you just have to replace
zipfile_path = glob.glob(
os.path.join(data_dir_extracted_path, data_archive_path, "*.zip")
)[0]
by
zipfile_path = glob.glob(
os.path.join(data_dir_extracted_path, f"subject{subject:02d}"+"*.zip")
)[0]
and it should work. The problem was comming from the fact that glob.glob was searching a pattern looking like "FOLDERNAME\subject01.zip*.zip" which doesn't exists instead of "FOLDERNAME\subject01*.zip" (by which i replaced). It could be "FOLDERNAME\subject01.zip" directly if you prefer but then there's no use in using glob here to search for pattern.
Again thank you for the detailed bug reports :)
You are working on windows right? I cannot reproduce this bug locally, but will boot up my windows machine soon and check there.
Hi, Yes, I am working on Windows. Another possibility is that this is coming from different versions of python and therefore glob itself. I'm currently working on Python 3.9.10 for information.
Hi, I had trouble to reproduce the error but I could finally reproduce it. I switched from os/glob to pathlib to avoid problems and submitted a PR.