ShahriyarR / MySQL-AutoXtraBackup

MySQL-AutoXtraBackup commandline tool written in Python 3 based on Percona XtraBackup
https://autoxtrabackup.azepug.az/
MIT License
140 stars 79 forks source link

error LANG UTF-8 #328

Closed BarbzYHOOL closed 5 years ago

BarbzYHOOL commented 5 years ago

Any idea why I get this error:

Traceback (most recent call last):
  File "/usr/local/bin/autoxtrabackup", line 11, in <module>
    sys.exit(all_procedure())
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 676, in main
    _verify_python3_env()
  File "/usr/local/lib/python3.6/dist-packages/click/_unicodefun.py", line 118, in _verify_python3_env
    'for mitigation steps.' + extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment.  Consult http://click.pocoo.org/python3/for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
ShahriyarR commented 5 years ago

Again it seems to be an issue for click library. You can check if suggested environment variables fixes the issue. Please do following exports and check again.

BarbzYHOOL commented 5 years ago

yeah but they fuck up everything else xD

I can change to en_US but still I had already configured my locales so it's kind of surprising it asks me for that

ShahriyarR commented 5 years ago

I am unaware of what is going on there for sure :) Maybe I will detect the same thing with my fresh installation.

ShahriyarR commented 5 years ago

I did not find such issue with my environment. So closing.

BarbzYHOOL commented 5 years ago

@ShahriyarR I have this issue again when running the script in a crontab, because cron doesn't have my environment variable set

Can't you do something about it? lol I'm wondering if it's because I use LXC containers or if it's something that can be fixed in autoxtrabackup

And do you have this issue if you try to run autoxtrabackup in a crontab?

ShahriyarR commented 5 years ago

@BarbzYHOOL

Well, even in official doc they have mentioned the problem: https://click.palletsprojects.com/en/7.x/python3/#python-3-surrogate-handling

One of the questions: https://stackoverflow.com/questions/32234393/encoding-issue-with-python3-and-click-package

You can specify this env variables in crontab as described here: https://stackoverflow.com/questions/2229825/where-can-i-set-environment-variables-that-crontab-will-use

BarbzYHOOL commented 5 years ago

And do you have this issue if you try to run autoxtrabackup in a crontab? (in your own setup)

ShahriyarR commented 5 years ago

@BarbzYHOOL I have no crontab related to autoxtrabackup to check with.

BarbzYHOOL commented 5 years ago

add in cron.hourly/

#!/bin/sh

autoxtrabackup --backup

if you want to test

ShahriyarR commented 5 years ago

I know how to add things to crontab but still it is not an issue with autoxtrabackup it is related to click library which clearly described this issue and stated some workarounds. Please figure out how to add env variables in cronjob.

BarbzYHOOL commented 5 years ago

ok so it means you would have this issue too and you don't use autoxtrabackup in a crontab?? weird I thought everybody would put it in cron

ShahriyarR commented 5 years ago

I have used as others and there was no issue like yours, until you have opened this issue. So yes it means you will have such issue - you need to figure out how to pass env variables. That's it.

BarbzYHOOL commented 5 years ago

Ah finally, thank you for finally answering -__-

and I don't want to pass env variable in the script if you guys don' tdo it, it makes no sense for me to do it, it's extremely dirty