Giter Club home page Giter Club logo

Comments (5)

bu-bgregor avatar bu-bgregor commented on September 26, 2024

The additional Unicode characters that cause a UnicodeEncodeError with check_setup.py and Python 3.6 are on lines 50-55 of check_setup.py:

status = {
        True:  success("✔ yes"),
        False: failure("✘ no"),
        None:  warning("⚑ warning"),
        ...:   unknown("? unknown"),
    }

from cli.

tsibley avatar tsibley commented on September 26, 2024

@terrycojones I believe this occurs when your terminal isn't using a Unicode locale, such as en_US.UTF-8 for example. Can you paste the output of running the locale command?

Some CLI frameworks like Click do a lot of contortions to automagically deal with terminal encoding issues, but this project doesn't use Click (yet…?) and currently assumes a Unicode locale.

from cli.

terrycojones avatar terrycojones commented on September 26, 2024

@tsibley Ah, yes, you're right, thanks. Setting LC_ALL to C.UTF-8 fixed it for me. I already had LANG=en_US.UTF-8 but that wasn't enough.

I guess for this issue, if anyone has the time/interest, printing a test (e.g., zero-width space) unicode char and catching UnicodeEncodeError would allow you to decide what to output. But maybe that's overkill. The exception could also be caught and you could print out a line telling the user what to do, depending on what shell they are using :-) Or, just close this issue......

from cli.

tsibley avatar tsibley commented on September 26, 2024

@terrycojones Glad it's fixed for you!

Testing for UnicodeEncodeError is a clever way of detecting support! I'd think you could also inspect the encoding of stdout, but that might lie. :-) In any case, I expect the best way to solve this is to adopt the Unicode terminal support and fallback handling from a robust library like Click instead of implementing it ourselves.

I'll leave this issue open as a reminder that this does exist as a legitimate issue and for anyone who might come across the same error and need a fix.

from cli.

terrycojones avatar terrycojones commented on September 26, 2024

Thanks for the pointer to Click, I'd not heard of it. Re leaving the issue open - up to you, of course. I would close it :-)

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.