Skip to content

Conversation

@bebound
Copy link
Contributor

@bebound bebound commented Dec 2, 2022

Description

Fix #24788.

az start with python -m and -m adds the current directory to the start of sys.path.

In #24788, if the working dir has a brotli folder, urllib3 will import it and lead to error.
https://github.com/urllib3/urllib3/blob/0612a53f48f72ab6e9ef58ccf1d6a25b847152fc/src/urllib3/response.py#L17-L23

To remove current dir from path, -I is needed.

-I option can be used to run the script in isolated mode where sys.path contains neither the current directory nor the user’s site-packages directory. All PYTHON* environment variables are ignored, too. ----Python doc

-I has already been added in entrypoint on Linux and Windows, this PR adds it on MacOS.


This checklist is used to make sure that common guidelines for a pull request are followed.

@ghost ghost requested review from jiasli, kairu-ms, wangzelin007 and yonzhan December 2, 2022 07:07
@ghost ghost added the Auto-Assign Auto assign by bot label Dec 2, 2022
@ghost ghost assigned jiasli Dec 2, 2022
@ghost ghost added this to the Dec 2022 (2023-01-03) milestone Dec 2, 2022
@ghost ghost added the Packaging label Dec 2, 2022
@bebound bebound marked this pull request as ready for review December 2, 2022 07:37
@bebound bebound requested a review from calvinhzy as a code owner December 2, 2022 07:37
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 2, 2022

Packaging

@jiasli
Copy link
Member

jiasli commented Jan 31, 2023

I happen to have a PR to refine the help message for -I 😆 :

@jiasli
Copy link
Member

jiasli commented Jan 31, 2023

Very clear PR description!

@bebound bebound merged commit f671453 into Azure:dev Jan 31, 2023
avgale pushed a commit to avgale/azure-cli that referenced this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az crashes if the CWD includes a subdirectory named "brotli"

3 participants