I need to copy a file from a remote machine.
The code is something like this
import shutil
shutil.copyfile('//XXX.XXX.XXX.XXX/home/Shares Folder/file.txt','/home/file.txt')
the location of the file is a shared folder but everytime I run this it gives me this error
File "", line 1, in ?
File "usr/lib/python2.4/shutil.py", line 47, in copyfile
frsc = open (src,'rb')
IOError: [Errno 2] No such file or directory : '//XXX.XXX.XXX.XXX/home/Shares Folder/file.txt'
Please take note that I'm running this script in my current machine and the the file that I want to copy is in the remote machine. I am not sure if this detail's relevant, I'm saying anyway.
Im 100% sure that the file is there so I was wondering why it's giving me such error message.
Im using CentOS and python 2.4.3
any ideas?
shutil
doesn't support remote file copies. It's for local copies only.
If both of your machines are UNIX-based, you can try and employ some modules for a transport that you have available (SSH/SFTP
, rsync
, whanot)