Giter VIP home page Giter VIP logo

If using Python 3 and run from within SourceTree Custom Actions, throws "RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment." about pygitup HOT 8 CLOSED

sompylasar avatar sompylasar commented on June 15, 2024
If using Python 3 and run from within SourceTree Custom Actions, throws "RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment."

from pygitup.

Comments (8)

wolph avatar wolph commented on June 15, 2024 1

I would think so. If anything it's an upstream issue which you can't solve anyhow. I'd recommend adding it to the FAQ and be done with it :)

from pygitup.

sompylasar avatar sompylasar commented on June 15, 2024

The workaround is to point SourceTree Custom Action to a Bash script that sets the locale and then invokes git-up.

The referenced 'Click' library page describes why this is needed when using Python 3.

#!/bin/bash

set -eu

REPO_PATH=$1

if [[ ! -d "${REPO_PATH}" ]]; then
	exit -1
fi

( cd "${REPO_PATH}" && LC_ALL=en_US.utf-8 LANG=en_US.utf-8 /usr/local/bin/git-up )

from pygitup.

msiemens avatar msiemens commented on June 15, 2024

Aside from getting rid of click altogether I don't think there's much I can do here. I'm glad you were able to find a workaround, though!

from pygitup.

wolph avatar wolph commented on June 15, 2024

The correct fix is to set your locale correctly in your environment variables.

Adding something like this does the trick on most machines:

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

If you add that to the /etc/profile file you won't get this issue anymore

from pygitup.

msiemens avatar msiemens commented on June 15, 2024

@sompylasar Do the settings mentioned here #72 (comment) fix the issue for you?

from pygitup.

sompylasar avatar sompylasar commented on June 15, 2024

@msiemens I'm using the wrapper script that works regardless of the environment. Changing the environment is too much of an ask, it would affect a lot more than needed.

from pygitup.

msiemens avatar msiemens commented on June 15, 2024

Can we close the issue then? I know it's only a workaround to use a wrapper script or to change the locale, but I guess it's all we can do for now

from pygitup.

sompylasar avatar sompylasar commented on June 15, 2024

@msiemens @wolph Okay, let's close it then.

from pygitup.

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.