MIC-DKFZ / batchgenerators

A framework for data augmentation for 2D and 3D image classification and segmentation
Apache License 2.0
1.09k stars 221 forks source link

maybe_mkdir_p does not work on Windows #69

Closed nlessmann closed 3 years ago

nlessmann commented 3 years ago

I read that Windows-support is only experimental, but one of the functions that does really not work is maybe_mkdir_p() since it splits the path based on a hardcoded forward slash.

A quick fix could be to switch to the mkdir function of the Path class from pathlib:

from pathlib import Path

def maybe_mkdir_p(directory):
    Path(directory).mkdir(parents=True, exist_ok=True)
FabianIsensee commented 3 years ago

Sounds like a good solution to me. If you want you can make a pull request so that people can see this part comes from you. If not I can quickly change that myself. As you like. Best, Fabian

FabianIsensee commented 3 years ago

Thanks :-)