You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[fNIRS] Misleading error message when the raw_data path does not exist #7913
When the path provided by the user does not exist (i.e. when the directory does not exist), the error message raised by the RAWNirx__init__ function is
RuntimeError: Expect one evt file, got 0
I think it should be something like
RuntimeError: The path you specified does not exist
since the error is not about the existence of a file, but rather about the directory's
Steps to reproduce
Create a RAWNirx instance by reading the data of a non-existent directory :
The error message tells the user the path to the specified directory does not exist.
Actual results
The error message tells the user the specified directory lacks an *.evt file (since it is the first file extension that is checked) but not that the directory does not exist: the existence of the directory is not checked, which is misleading the user.
Additional information
Platform: Windows-10-10.0.18362-SP0
Python: 3.8.3 (default, May 19 2020, 06:50:17) [MSC v.1916 64 bit (AMD64)]
Executable: C:\Users\juliend\Anaconda3\envs\mne_dev\python.exe
CPU: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel: 8 cores
Memory: 15.6 GB
if not op.exists(fname):
raise RuntimeError('The path you specified does not exist.')
or
if not op.isdir(fname):
raise RuntimeError('The path you specified does not exist.')
at the start of __init function of RAWNirx does not [EDIT: see this comment] lead to raising the error, if fname is a non-existent path; there must be a "good" reason for that. I'm in to correct the behaviour if you think it should be fixed.
Does the snippet work on your end @rob-luke ? I should have made it clearer that it doesn't work for me, but I don't know why : even if I give a random path to the function, the error raised is still about the *.evt file
Nevermind that, I had another snippet that was interfering.
Activity
larsoner commentedon Jun 22, 2020
This does seem like something that should be fixed, but let's wait to hear from @rob-luke to see if he agrees or has something else in mind first
rob-luke commentedon Jun 23, 2020
Sounds good. I added this code snippet to #7905
Thanks @swy7ch for taking the time to report these issues and the neat fixes
swy7ch commentedon Jun 23, 2020
Does the snippet work on your end @rob-luke ? I should have made it clearer that it doesn't work for me, but I don't know why : even if I give a random path to the function, the error raised is still about the *.evt fileNevermind that, I had another snippet that was interfering.
rob-luke commentedon Jun 23, 2020
And @swy7ch please feel free to review #7905 to make sure it meets your needs