Comments (9)
Thank you for opening this issue, we will look into it.
from azure-cli.
I find the cause.
This only happens in Python 3.11.9, this commit introduce the API change: python/cpython#115674
Similar issue: kislyuk/argcomplete#483
Fixed in argcomplete
3.3.0: kislyuk/argcomplete@54a4846
from azure-cli.
CLI has its own site-packages
, you need to update it there.
The path is /opt/homebrew/Cellar/azure-cli/2.59.0/libexec/lib64/python3.11/site-packages
from azure-cli.
I can't repro. AFAIK, the related code is not changed.
Does this command produce any strange errors? _ARC_DEBUG=1 IFS=$'\013' COMP_LINE='az vm show -g ' COMP_POINT=14 COMP_TYPE="" _ARGCOMPLETE=1 _ARGCOMPLETE_SUPPRESS_SPACE=0 az 8>&1 1>&2 2>&2 9>&1
from azure-cli.
I can't repro. AFAIK, the related code is not changed.
Does this command produce any strange errors?
_ARC_DEBUG=1 IFS=$'\013' COMP_LINE='az vm show -g ' COMP_POINT=14 COMP_TYPE="" _ARGCOMPLETE=1 _ARGCOMPLETE_SUPPRESS_SPACE=0 az 8>&1 1>&2 2>&2 9>&1
Not sure if this counts as strange:
❯ _ARC_DEBUG=1 IFS=$'\013' COMP_LINE='az vm show -g ' COMP_POINT=14 COMP_TYPE="" _ARGCOMPLETE=1 _ARGCOMPLETE_SUPPRESS_SPACE=0 az 8>&1 1>&2 2>&2 9>&1
word -g split, lexer state: ' '
In trailing whitespace
LINE: 'az vm show -g '
POINT: 14
PREQUOTE: ''
PREFIX: ''
SUFFIX: ''
WORDS: ['az', 'vm', 'show', '-g']
Active parsers: [MonkeyPatchedIntrospectiveArgumentParser(prog='az', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)]
Visited positionals: [MonkeyPatchedIntrospectiveArgumentParser(prog='az', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)]
invoking parser with ['vm', 'show', '-g']
Action stub called on IntrospectAction(option_strings=[], dest='_command_package', nargs='A...', const=None, default=None, type=None, choices={'vm': AzCliCommandParser(prog='az vm', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)}, required=True, help=None, metavar=None)
args: MonkeyPatchedIntrospectiveArgumentParser(prog='az', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True) Namespace(_log_verbosity_verbose=False, _log_verbosity_debug=False, _log_verbosity_only_show_errors=False, _output_format='json', _jmespath_query=None, _command_package=None) ['vm', 'show', '-g'] None
orig class: <class 'argparse._SubParsersAction'>
orig callable: <bound method _SubParsersAction.__call__ of IntrospectAction(option_strings=[], dest='_command_package', nargs='A...', const=None, default=None, type=None, choices={'vm': AzCliCommandParser(prog='az vm', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)}, required=True, help=None, metavar=None)>
orig class is a subparsers action: patching and running it
Action stub called on IntrospectAction(option_strings=[], dest='_subcommand', nargs='A...', const=None, default=None, type=None, choices={'show': AzCliCommandParser(prog='az vm show', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)}, required=True, help=None, metavar=None)
args: MonkeyPatchedIntrospectiveArgumentParser(prog='az vm', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True) Namespace(_subcommand=None) ['show', '-g'] None
orig class: <class 'argparse._SubParsersAction'>
orig callable: <bound method _SubParsersAction.__call__ of IntrospectAction(option_strings=[], dest='_subcommand', nargs='A...', const=None, default=None, type=None, choices={'show': AzCliCommandParser(prog='az vm show', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)}, required=True, help=None, metavar=None)>
orig class is a subparsers action: patching and running it
exception <class 'ValueError'> too many values to unpack (expected 3) while parsing args
all active parsers: [MonkeyPatchedIntrospectiveArgumentParser(prog='az', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), MonkeyPatchedIntrospectiveArgumentParser(prog='az vm', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), MonkeyPatchedIntrospectiveArgumentParser(prog='az vm show', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)]
active_parser: MonkeyPatchedIntrospectiveArgumentParser(prog='az vm show', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
optional options: ['-h', '--help', '--verbose', '--debug', '--only-show-errors', '--output', '-o', '--query', '--subscription', '--resource-group', '-g', '--name', '-n', '--show-details', '-d', '--include-user-data', '-u', '--ids']
next_positional: None
Active actions (L=0): []
active options: ['-h', '--help', '--verbose', '--debug', '--only-show-errors', '--output', '-o', '--query', '--subscription', '--resource-group', '-g', '--name', '-n', '--show-details', '-d', '--include-user-data', '-u', '--ids']
display completions: {'-h': 'show this help message and exit', '--help': 'show this help message and exit', '--verbose': 'Increase logging verbosity. Use --debug for full debug logs.', '--debug': 'Increase logging verbosity to show all debug logs.', '--only-show-errors': 'Only show errors, suppressing warnings.', '--output': 'Output format', '-o': 'Output format', '--query': 'JMESPath query string. See http://jmespath.org/ for more information and examples.', '--subscription': 'Name or ID of subscription. You can configure the default subscription using `az account set -s NAME_OR_ID`', '--cmd': '==SUPPRESS==', '--resource-group': 'Name of resource group. You can configure the default group using `az configure --defaults group=<name>`', '-g': 'Name of resource group. You can configure the default group using `az configure --defaults group=<name>`', '--name': 'The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=<name>`', '-n': 'The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=<name>`', '--show-details': 'show public ip address, FQDN, and power states. command will run slow', '-d': 'show public ip address, FQDN, and power states. command will run slow', '--include-user-data': 'Include the user data properties in the query result.', '-u': 'Include the user data properties in the query result.', '--ids': "One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments."}
Returning completions: ['-h', '--help', '--verbose', '--debug', '--only-show-errors', '--output', '-o', '--query', '--subscription', '--resource-group', '-g', '--name', '-n', '--show-details', '-d', '--include-user-data', '-u', '--ids']
-h
--help
--verbose
--debug
--only-show-errors
--output
-o
--query
--subscription
--resource-group
-g
--name
-n
--show-details
-d
--include-user-data
-u
from azure-cli.
exception <class 'ValueError'> too many values to unpack (expected 3) while parsing args
and the following content are strange.
It should be
exception <class 'SystemExit'> 2 while parsing args
all active parsers: [MonkeyPatchedIntrospectiveArgumentParser(prog='az', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), MonkeyPatchedIntrospectiveArgumentParser(prog='az vm', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), MonkeyPatchedIntrospectiveArgumentParser(prog='az vm show', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)]
active_parser: MonkeyPatchedIntrospectiveArgumentParser(prog='az vm show', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
optional options: ['-h', '--help', '--verbose', '--debug', '--only-show-errors', '--output', '-o', '--query', '--subscription', '--resource-group', '-g', '--name', '-n', '--show-details', '-d', '--include-user-data', '-u', '--ids']
next_positional: None
Active actions (L=1): [IntrospectAction(option_strings=['--resource-group', '-g'], dest='resource_group_name', nargs=None, const=None, default=None, type=None, choices=None, required=False, help='Name of resource group. You can configure the default group using `az configure --defaults group=<name>`', metavar=None)]
Resetting completions because IntrospectAction(option_strings=['--resource-group', '-g'], dest='resource_group_name', nargs=None, const=None, default=None, type=None, choices=None, required=False, help='Name of resource group. You can configure the default group using `az configure --defaults group=<name>`', metavar=None) must consume the next argument
Activating completion for IntrospectAction(option_strings=['--resource-group', '-g'], dest='resource_group_name', nargs=None, const=None, default=None, type=None, choices=None, required=False, help='Name of resource group. You can configure the default group using `az configure --defaults group=<name>`', metavar=None) <class 'argparse._StoreAction'>
Completions: ['xxxxx']
xxxxx
I guess your installation is broken. Reinstalling may help.
from azure-cli.
Thanks for looking into this. I have attempted to uninstall and remove from my home directory the .azure directory. After reinstallation, I still get the wrong autocomplete. Is there something else that I might be doing wrong?
For what it's worth, I am seeing this on separate machines (corporate owned and personal) on different, unrelated subscriptions. Both are macOS Sonoma with zsh and homebrew packages all up to date.
❯ az aks stop -g -
the following arguments are required: --name/-n
Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs
❯
❯ brew uninstall azure-cli
Uninstalling /opt/homebrew/Cellar/azure-cli/2.59.0... (27,162 files, 636.8MB)
❯ rm -rf ~/.azure
❯ brew install azure-cli
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/manifests/2.59.0
Already downloaded: /Users/michaelsaul/Library/Caches/Homebrew/downloads/089b83c5de720d3e3e50c52adce5b57551a7a67635bb05f0458060efa9aa5b31--azure-cli-2.59.0.bottle_manifest.json
==> Fetching azure-cli
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/blobs/sha256:0abaf4f43b8af2cb406ff2dccc1a8aea716734333abdcb35f1f00
Already downloaded: /Users/michaelsaul/Library/Caches/Homebrew/downloads/75cd309278615f3584d4e773c64cd9f558ff4025cfca21d092dddcf3fb7049bb--azure-cli--2.59.0.arm64_sonoma.bottle.tar.gz
==> Pouring azure-cli--2.59.0.arm64_sonoma.bottle.tar.gz
Warning: Cask azure-cli was renamed to homebrew/core/azure-cli.
🍺 /opt/homebrew/Cellar/azure-cli/2.59.0: 23,530 files, 553.7MB
==> Running `brew cleanup azure-cli`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
❯ az login
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
[
{
"cloudName": "AzureCloud",
"homeTenantId": "GUID",
"id": "GUID",
"isDefault": true,
"managedByTenants": [],
"name": "SUB_NAME",
"state": "Enabled",
"tenantId": "GUID",
"user": {
"name": "EMAIL",
"type": "user"
}
}
]
❯ source ~/.zshrc
~ az vm show -g -
--debug --name --resource-group -d -o
--help --only-show-errors --show-details -g -u
--ids --output --subscription -h
--include-user-data --query --verbose -n
from azure-cli.
Thank you so much for finding that! I did check and had updated to argcomplete
3.3.0, still getting an error. Does this need to be reflected somewhere in the homebrew package for azure-cli?
❯ echo $FPATH
/opt/homebrew/share/zsh-completions:/opt/homebrew/share/zsh/site-functions:/usr/local/share/zsh/site-functions:/usr/share/zsh/site-functions:/usr/share/zsh/5.9/functions
❯ brew info python-argcomplete
==> python-argcomplete: stable 3.3.0 (bottled)
Tab completion for Python argparse
https://kislyuk.github.io/argcomplete/
Installed
/opt/homebrew/Cellar/python-argcomplete/3.3.0 (53 files, 288.7KB) *
Poured from bottle using the formulae.brew.sh API on 2024-04-24 at 14:44:41
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/p/python-argcomplete.rb
License: Apache-2.0
==> Dependencies
Build: [email protected] ✔, [email protected] ✔
==> Analytics
install: 7,142 (30 days), 32,204 (90 days), 72,956 (365 days)
install-on-request: 412 (30 days), 1,019 (90 days), 1,878 (365 days)
build-error: 0 (30 days)
❯ ls -al $HOMEBREW_PREFIX/share/zsh/site-functions | grep argcomplete
-rw-r--r-- 1 michaelsaul admin 9852 Apr 24 14:55 _python-argcomplete
❯ pip list | grep argcomplete
argcomplete 3.3.0
from azure-cli.
Thank you @bebound In case anyone else needs an update before the new version is shipped, you can do the following:
cd /opt/homebrew/Cellar/azure-cli/2.59.0/libexec/lib/python3.11/site-packages
mv argcomplete argcomplete.bak
mv argcomplete-3.1.1.dist-info argcomplete-3.1.1.dist-info.bak
ln -s /opt/homebrew/Cellar/python-argcomplete/3.3.0/lib/python3.11/site-packages/argcomplete argcomplete
ln -s /opt/homebrew/Cellar/python-argcomplete/3.3.0/lib/python3.11/site-packages/argcomplete-3.3.0.dist-info argcomplete-3.3.0.dist-info
from azure-cli.
Related Issues (20)
- az containerapp | missing examples in reference content HOT 6
- az restore flexible-server does not work HOT 6
- az security task list --resource-group $rg returns tasks like "$rg*" HOT 3
- Change API version: [Microsoft Internal / Azure CLI Tools - Azure CLI, PowerShell and Terraform] Feature Request HOT 2
- az rest cli commands fails in azure ubuntu agents HOT 3
- az functionapp create --min-tls-version doesn't exist HOT 1
- Assertion message from JMESPathCheck is misleading when actual result evaluates to False. HOT 1
- Service Bus purge / batch delete HOT 1
- Loading the mysql command module adding 5+ seconds to almost all commands. HOT 6
- Not able to login using azure-cli HOT 4
- Testing local Azure Function (Python) + VS Code + Azurite error: Token Expired HOT 4
- Azure Database for PostgreSQL Flexible Server failed to deploy HOT 4
- WAM broker failing in latest 2.63 release for at least ROPC flow HOT 16
- Azure CLI "az containerapp logs show" - retruns malformed JSON HOT 2
- Failed to connect to MSI to create service principle HOT 3
- Create OpenAPI v2/v3 and OpenAPI v1 schemas in API Management HOT 1
- Failed to add Load Balancer addresses to backend pools when syncMode of the Backend pool is set to 'Automatic' HOT 2
- Export SQL database to a local file HOT 1
- Microsoft.Network Resource Provider does not Register HOT 4
- Azure Language copy via az cli HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-cli.