The snippet below is code that has been working for years with web2py
2.16/2.17 and Python 2.7
It fails with web2py 2.18.2 and Python 3.7.2.
The log says:
01/Mar/2019-10:33:34: INFO : backups : 303 | backing up
db as
"applications/MFMCurrAssetMgr/private/_backups/bup_010319_103334/MFMCurrAssetMgr-db.csv"
01/Mar/2019-10:33:34: WARNING : backups : 309 | - db backup
Failed: exception: "a bytes-like object is required, not 'str'"
but the file is being created in "wb" mode, so why?
Am I missing something or is there
Enter code here...#
#
# Backup the db
#
logger.info(f'backing up db as "{session.db_backup_name}"')
with open(session.db_backup_name, 'wb') as backup_file:
try:
db.export_to_csv_file(backup_file)
logger.info(f' - db backup successful')
except Exception as why:
logger.warning(f' - db backup Failed: exception:
"{why}"')
raise
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.