I have been using the copy2 function to copy files and it has been working fine on the Linux system with both the source and destination directories in Linux. Recently I tried to use the Windows File share as the backend and was trying to copy files to my linux system. The code and the error displayed is as follows:
for afile in self.task_files:
copy2(os.path.join(self.uploads_directory, afile), self.files_directory)
count += 1`
Output:
Traceback (most recent call last):
File "/opt/backend/worker.py", line 43, in <module>
task.initialize()
File "/opt/backend/services/task.py", line 58, in initialize
copy2(os.path.join(self.uploads_directory, afile), self.files_directory)
File "/usr/lib/python3.5/shutil.py", line 252, in copy2
copystat(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.5/shutil.py", line 219, in copystat
_copyxattr(src, dst, follow_symlinks=follow)
File "/usr/lib/python3.5/shutil.py", line 151, in _copyxattr
names = os.listxattr(src, follow_symlinks=follow_symlinks)
OSError: [Errno 38] Function not implemented: '/data/uas/uploads/DJI_0049_vnbh0.JPG'
Is the copy2 function unable to transfer the files because of the OS or is it something else? Also is there any other function in python which can be used to copy files along with its metadata?