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

Questions about BrainVisa usage and installation

Moderators: riviere, denghien

francois
Posts: 63
Joined: Tue Jul 25, 2017 9:37 am

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

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

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

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

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

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

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


Return to “BrainVISA”

Who is online

Users browsing this forum: No registered users and 2 guests