kolibri: DB backup utility doesn't handle unicode output from iterdump

Observed behavior

When running kolibri, if database backup runs, it returns an error saying that charmap codec cannot encode character ‘\u259’.

Expected behavior

Backup should be created without errors

User-facing consequences

Could prevent a usable backup from being created

Errors and logs

Command Line:

Traceback (most recent call last):
  File "C:\Users\alanc\AppData\Local\Programs\Python\Python35\Lib\runpy.py", lin
e 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\alanc\AppData\Local\Programs\Python\Python35\Lib\runpy.py", lin
e 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\alanc\Kolibri\kolibri\kolibri\__main__.py", line 8, in <module>
    main(args=sys.argv[1:])
  File "C:\Users\alanc\Kolibri\kolibri\kolibri\utils\cli.py", line 632, in main
    initialize(debug=debug)
  File "C:\Users\alanc\Kolibri\kolibri\kolibri\utils\cli.py", line 200, in initi
alize
    backup = dbbackup(version)
  File "C:\Users\alanc\Kolibri\kolibri\kolibri\core\deviceadmin\utils.py", line
90, in dbbackup
    f.write(line)
  File "C:\Users\alanc\AppData\Local\Programs\Python\Python35\Lib\encodings\cp12
52.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u0259' in position
104: character maps to <undefined>

Steps to reproduce

Run yarn install and/or yarn run devserver on Windows 10 through Git bash.

Context

  • Kolibri version: develop
  • Operating system: Windows 10
  • Browser: NA

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

@radinamatic beware that these are two different errors both caused by the cp1252 encoding on Windows.

The one with dbbackup/dbrestore can only be provoked either by changing versions so dbbackup is invoked automatically, or you can test it manually by running kolibri manage dbbackup