Page 1 of 1

Modification of /python/brainvisa/shelltools.py when working on Windows shares

Posted: Thu Jan 31, 2019 6:56 pm
by francois
Hello,

When the BrainVISA database is located on a Windows share mounted as CIFS on Linux, shelltools.cp crashes.
The reason is that Linux cannot set properly the file access rights on a CIFS mount, and shutil.copy/shutil.copy2 crash instead of nicely handling the problem. In such configuration, I could not find any other solution than using either shutil.copyfile or the system's cp instead.

Therefore I think the function cp() in shelltools.py should be modified to handle these cases. A try/except block could capture these errors thrown by shutil.copy/shutil.copy2 and try again the copy with shutil.copyfile.
In my case, I just simply removed the test that sets "copy" to either shutil.copy or shutil.copy2, and enforce the use of shutil.copyfile. It works, but it is not a proper solution.

Hopefully we'll get this modification in the 4.6.2 :)

Cheers,
Francois

Re: Modification of /python/brainvisa/shelltools.py when working on Windows shares

Posted: Tue Feb 05, 2019 12:01 pm
by riviere
Hi,
I have changed the cp function in shelltools, you can try this version:
ftp://ftp.cea.fr/pub/dsv/anatomist/upda ... lltools.py
Denis