I am trying to archive databases and move them to different servers using Fabric .
If on a remote server to open a file for writing, it does not work with an error.
newFile = open('%s%s' % (dumpPath,newFileName) ,'w') IOError: [Errno 2] No such file or directory: '/home/ec2-user/dbbackup.sql.bz2'
These files exist, and I even tried to create them in advance just in case the fabric did not have permission to create, but it still did not work
run("touch dbbackup.sql.bz2")
EDIT: I know that I can upload files to a remote server, but thatβs not what I'm trying to do with the open command. I am trying to compress a large file (database dump). Is it possible to do this on a remote server, or will I need to copy the DB dump to the local host, compress and then load it back. Here is the compression on the local host:
compObj= bz2.BZ2Compressor() newFile = open('%s%s' % (dumpPath,newFileName) ,'w') dbFile = file( '%s%s' % (dumpPath,filename), "r" ) block= dbFile.read( BLOCK_SIZE ) while True:
Jiminycricket
source share