Skip to content
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

Invalid python escape sequence in azure resource graph extension #8369

Open
bb-froggy opened this issue Dec 13, 2024 · 2 comments
Open

Invalid python escape sequence in azure resource graph extension #8369

bb-froggy opened this issue Dec 13, 2024 · 2 comments
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Resource Graph Service Attention This issue is responsible by Azure service team.

Comments

@bb-froggy
Copy link

Describe the bug

In python, spaces need no escaping, but I've heard that only newer versions of python complain if you do it anyway, i.e. use '\ ' in a string. _models_py3.py of the resource graph extension seems to contain such escape sequences, though: In line 58, 62, 1201, and 1205. Some az commands now print a warning because of this in my environment, although that hasn't happened in the past and I cannot reproduce it in all environments. I assume it depends on the python version used.

Related command

az graph

Errors

This is the output on my machine:

PS D:\git\scepman-psmodule\SCEPman> az graph query
time specifying the date and time for the inclusive start and exclusive end, i.e. [start, end).
C:\Users\ChristophHannebauer.azure\cliextensions\resource-graph\azext_resourcegraph\vendored_sdks\resourcegraph\models_models_py3.py:1196: SyntaxWarning: invalid escape sequence '\ '
"""Specifies the date and time interval for a changes request.
the following arguments are required: _subcommand

Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs

Issue script & Debug output

PS D:\git\scepman-psmodule\SCEPman> az graph --debug
cli.knack.cli: Command arguments: ['graph', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x00000150686CF420>, <function OutputProducer.on_global_arguments at 0x0000015068A6C180>, <function CLIQuery.on_global_arguments at 0x0000015068A91580>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'graph': ['azext_resourcegraph']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: Total (0)                 0.000         0         0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: resource-graph            0.004         2         5  C:\Users\ChristophHannebauer\.azure\cliextensions\resource-graph
cli.azure.cli.core: Total (1)                 0.004         2         5  
cli.azure.cli.core: Loaded 2 groups, 5 commands.
cli.azure.cli.core: Found a match in the command group table for 'graph'.
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x000001506AD51DA0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\ChristophHannebauer\.azure\commands\2024-12-13.14-11-57.graph.11056.log'.
az_command_data_logger: command args: graph --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x000001506ADB9800>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x000001506ADB98A0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x000001506ADB99E0>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x000001506ADB9A80>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
C:\Users\ChristophHannebauer\.azure\cliextensions\resource-graph\azext_resourcegraph\vendored_sdks\resourcegraph\models\_models_py3.py:53: SyntaxWarning: invalid escape sequence '\ '
  """An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. ``[start, end)``.
C:\Users\ChristophHannebauer\.azure\cliextensions\resource-graph\azext_resourcegraph\vendored_sdks\resourcegraph\models\_models_py3.py:1196: SyntaxWarning: invalid escape sequence '\ '   
  """Specifies the date and time interval for a changes request.
urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443
urllib3.connectionpool: https://app.aladdin.microsoft.com:443 "GET /api/v1.0/suggestions?query=%7B%22command%22%3A+%22graph%22%2C+%22parameters%22%3A+%22%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.67.0%22%2C+%22errorType%22%3A+%22MissingRequiredSubcommand%22%2C+%22correlationId%22%3A+%22cdc9d4af-640a-424f-8915-4105e2de1ba8%22%2C+%22subscriptionId%22%3A+%22627684de-d5d0-4a61-8fdb-fbcc37f8db7b%22%2C+%22eventId%22%3A+%22e5291b07-b59d-4196-a5cd-9ca9ef7cee63%22%7D HTTP/1.1" 200 None
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "argparse.py", line 1931, in parse_known_args
  File "argparse.py", line 2196, in _parse_known_args
argparse.ArgumentError: the following arguments are required: _subcommand

cli.azure.cli.core.azclierror: the following arguments are required: _subcommand
az_command_data_logger: the following arguments are required: _subcommand

Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x000001506AD52020>]
az_command_data_logger: exit code: 2
cli.__main__: Command ran in 0.929 seconds (init: 0.284, invoke: 0.644)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3824 in cache file under C:\Users\ChristophHannebauer\.azure\telemetry\20241213141157786
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\ChristophHannebauer\.azure C:\Users\ChristophHannebauer\.azure\telemetry\20241213141157786"
telemetry.process: Return from creating process 43816
telemetry.main: Finish creating telemetry upload process.

Expected behavior

There should be no warning about the invalid escape sequence.

Environment Summary

azure-cli 2.67.0

core 2.67.0
telemetry 1.1.0

Extensions:
resource-graph 2.1.0

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\ChristophHannebauer.azure\cliextensions'

Python (Windows) 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

The code is auto-generated by autorest, so probably, there is an upstream issue in autorest

@bb-froggy bb-froggy added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Dec 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Dec 13, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 13, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Dec 13, 2024
@yonzhan yonzhan added Resource Graph Service Attention This issue is responsible by Azure service team. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 14, 2024
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @venu-l.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Resource Graph Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants