VUIIS / dax

Distributed Automation for XNAT
MIT License
25 stars 24 forks source link

os.rmdir was not removing the non-empty directories. shutil.rmtree re… #416

Closed KarthikMasi closed 1 year ago

KarthikMasi commented 1 year ago

…moves it

Tested this against a test BIDS directory with correct bids mapping and it works.

baxpr commented 1 year ago

We avoided rmtree on purpose because it is so dangerous. Why did rmdir fail? If there are residual files in there they should be cleared out. If there is ever something wrong with sess_path the rmtree could do some bad stuff

KarthikMasi commented 1 year ago

Also, XnatToBids just names subjects and sessions as "sub-01" and "ses-01" when used with Xnatdownload. I will add a patch for the same.

baxpr commented 1 year ago

There is already a command line option --xnat_tag for Xnatdownload that is supposed to use the XNAT subj/session names for the BIDS files - is it not working?

baxpr commented 1 year ago

Might be better to use tempfile.TemporaryDirectory in a with context to store the intermediates, although that can complicate debugging. Would completely avoid the rmtree/rmdir dilemma though