Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In Tutorial 6, the following error message occurs when trying to run the tutorial more than once:
Cell In[10], line 14
11 index = femr.index.PatientIndex(dataset, num_proc=4)
12 main_split = femr.splits.generate_hash_split(index.get_patient_ids(), 97, frac_test=0.15)
---> 14 os.mkdir(os.path.join(TARGET_DIR, 'motor_model'))
15 # Note that we want to save this to the target directory since this is important information
17 main_split.save_to_csv(os.path.join(TARGET_DIR, "motor_model", "main_split.csv"))
FileExistsError: [Errno 17] File exists: 'trash/tutorial_6/motor_model'
The error occurs because the directory 'trash/tutorial_6/motor_model' already exists when the code tries to create it. To fix this, use os.makedirs() instead of os.mkdir() with a exist_ok=True parameter so a FileExistsError is not raised if the directory already exists. This allows for the tutorial code to be run more than once.