i did a backup with db.py help
# Backup DB
# service/db.py: def exp_dump(db_name):
def backup(args):
with open(args.filedump, 'w') as f:
f.write(server.dump(args.superpwd, args.database).decode('base64'))
if f:
print 'Database Backup File Name: %s' % f.name
sys.exit(0)
else:
sys.exit(2)
This Works great, the zip file created works in the gui at restore perfectly, now i want to write another script to use the restore function, but i am getting an error
used this
# Restore DB
# service/db.py: def exp_restore(db_name, data, copy=False):
def restore(args):
print 'Restore Database: %s' % args.database
if server.restore(args.superpwd, args.database, args.filedump):
sys.exit(0)
else:
sys.exit(2)
this raises the error of the following, anyone a short IDEA of what the problem could be?
Traceback (most recent call last): File "/opt/odoo_v8.0/TOOLS/db-tools.py", line 108, in <module> args.func(args) File "/opt/odoo_v8.0/TOOLS/db-tools.py", line 57, in restore if server.restore(args.superpwd, args.database, args.filedump): File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.7/xmlrpclib.py", line 1587, in __request verbose=self.__verbose File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request return self.single_request(host, handler, request_body, verbose) File "/usr/lib/python2.7/xmlrpclib.py", line 1306, in single_request return self.parse_response(response) File "/usr/lib/python2.7/xmlrpclib.py", line 1482, in parse_response return u.close() File "/usr/lib/python2.7/xmlrpclib.py", line 794, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault Incorrect padding: 'Traceback (most recent call last):\n File "/opt/odoo_v8.0/odoo/openerp/service/wsgi_server.py", line 75, in xmlrpc_return\n result = openerp.http.dispatch_rpc(service, method, params)\n File "/opt/odoo_v8.0/odoo/openerp/http.py", line 115, in dispatch_rpc\n result = dispatch(method, params)\n File "/opt/odoo_v8.0/odoo/openerp/service/db.py", line 73, in dispatch\n return fn(*params)\n File "/opt/odoo_v8.0/odoo/openerp/service/db.py", line 215, in exp_restore\n data_file.write(data.decode(\'base64\'))\n File "/usr/lib/python2.7/encodings/base64_codec.py", line 42, in base64_decode\n output = base64.decodestring(input)\n File "/usr/lib/python2.7/base64.py", line 321, in decodestring\n return binascii.a2b_base64(s)\nError: Incorrect padding\n'>Traceback (most recent call last):
File "/opt/odoo_v8.0/TOOLS/db-tools.py", line 108, in <module>
args.func(args)
File "/opt/odoo_v8.0/TOOLS/db-tools.py", line 57, in restore
if server.restore(args.superpwd, args.database, args.filedump):
File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1587, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1306, in single_request
return self.parse_response(response)
File "/usr/lib/python2.7/xmlrpclib.py", line 1482, in parse_response
return u.close()
File "/usr/lib/python2.7/xmlrpclib.py", line 794, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault Incorrect padding: 'Traceback (most recent call last):\n File "/opt/odoo_v8.0/odoo/openerp/service/wsgi_server.py", line 75, in xmlrpc_return\n result = openerp.http.dispatch_rpc(service, method, params)\n File "/opt/odoo_v8.0/odoo/openerp/http.py", line 115, in dispatch_rpc\n result = dispatch(method, params)\n File "/opt/odoo_v8.0/odoo/openerp/service/db.py", line 73, in dispatch\n return fn(*params)\n File "/opt/odoo_v8.0/odoo/openerp/service/db.py", line 215, in exp_restore\n data_file.write(data.decode(\'base64\'))\n File "/usr/lib/python2.7/encodings/base64_codec.py", line 42, in base64_decode\n output = base64.decodestring(input)\n File "/usr/lib/python2.7/base64.py", line 321, in decodestring\n return binascii.a2b_base64(s)\nError: Incorrect padding\n'>
Thanks in Advance cheers