Modification of /python/brainvisa/ when working on Windows shares

Questions about BrainVisa usage and installation

Moderators: riviere, denghien

Posts: 61
Joined: Tue Jul 25, 2017 9:37 am

Modification of /python/brainvisa/ when working on Windows shares

Postby francois » Thu Jan 31, 2019 6:56 pm


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 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 :)


User avatar
Site Admin
Posts: 1358
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France

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

Postby riviere » Tue Feb 05, 2019 12:01 pm

I have changed the cp function in shelltools, you can try this version: ...

Return to “BrainVISA”

Who is online

Users browsing this forum: Bing [Bot] and 14 guests