-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Unicode #8777
Comments
As it turns out, running the following command before running any Azure CLI command solves the problem:
|
Running the following command before running any Azure CLI commands avoids the problem:
|
I spoke too soon. Issue still exists... :-( |
related: #8312, #6408, #4418, #1277
|
Worked around this on my Mac by forcing the use of azure-cli from Homebrew instead of Pip: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-macos
|
@bartoostlander, seems like the workaround is effectively "use Python3 for the Azure CLI". This is easy for @PatMyron, who is installing with brew because Python3 is the default in that environment. However, since you're coming from Red Hat, I'll assume you install from the RPM that we publish. That makes it trickier, as my understanding is that Python3 won't be available through first party repositories until EL8. Do you have access to a python3 package through third party repositories? |
@marstr , I installed Python 3.6 from the RedHat SCL. I can then run "scl enable rh-python36 bash" and run my script (that does "az storage blob exists"). Echoing "which python" in that script confirms that Python 3.6 is active. However, the "az storage" command on the next line still gives the same error, referring to Python 2.7! Apparently, I need to do something to convince the Azure CLI to use the currently active Python version. What could that be? |
Yep, that's expected! We try to isolate ourselves from system-python by running in a virtualenv. Which in general is a great thing, but in this particular case it makes hard to break-open your install to change things. (While not what we usually recommend) In this case the easiest thing will be to install directly from PyPI using pip by doing the following: # remove the old azure-cli install for cleanliness
yum erase -y azure-cli
# get python3 if you don't already have it (@bartoostlander can skip this)
## your SCL may vary if you're not using CentOS
yum install -y centos-release-scl
yum install -y rh-python36
scl enable rh-python36 bash
# Create a virtualenv where you would like to install the azure-cli
## Make sure that python invokes python3 before executing this step. If it doesn't, run the scl enable from above; this is because scl enable isn't durable between bash sessions.
cd ${yourDesiredLocation}
python -m virtualenv azure-cli
# Install the Azure-CLI from PyPI into this virtualenv
./azure-cli/bin/python -m pip install azure-cli
# Create a launcher for the azure-cli, and make it executable
cat > /usr/bin/az << EOM
#!/usr/bin/env bash
${yourDesiredLocation}/azure-cli/bin/python -m azure.cli "\$@"
EOM
chmod +x /usr/bin/az
To remove this installation, all you'll have to do is delete |
Aha! You just saved me from going doing a rabbit hole. I'll follow your instructions. Your responsiveness is highly appreciated! |
Preliminary observation: it works... I'll close this issue after further validation. Thank you! |
Success. Thank you, @marstr ! |
|
Hi Team, I get the error:
when I execute "az storage blob exists".
To reproduce
Expected behavior
In the past, this returned an object or string with
_true_
or_false_
in it. Since early this year it throws a UnicodeEncodeError error inutil.py
.Environment summary
azure-cli 2.0.59, bash shell, Red Hat Enterprise Linux Server release 7.6 (Maipo) running Python 2.7.5 [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on a server in Azure SouthCentral, and on an identical one in Azure West.
Additional context
The script running the 'offending' command is an essential step in our Disaster Recovery procedure and runs nightly.
The text was updated successfully, but these errors were encountered: