Describe the bug
az monitor activity-log list command exception
$ az monitor activity-log list
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/knack/cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute
self.commands_loader.load_arguments(command)
File "/usr/local/lib/python2.7/site-packages/azure/cli/core/__init__.py", line 254, in load_arguments
loader.load_arguments(command) # this adds entries to the argument registries
File "/usr/local/lib/python2.7/site-packages/azure/cli/command_modules/monitor/__init__.py", line 45, in load_arguments
from azure.cli.command_modules.monitor._params import load_arguments
File "/usr/local/lib/python2.7/site-packages/azure/cli/command_modules/monitor/_params.py", line 14, in <module>
from azure.cli.command_modules.monitor.actions import (
File "/usr/local/lib/python2.7/site-packages/azure/cli/command_modules/monitor/actions.py", line 8, in <module>
import antlr4
File "/usr/local/lib/python2.7/site-packages/antlr4/__init__.py", line 1, in <module>
from antlr4.Token import Token
File "/usr/local/lib/python2.7/site-packages/antlr4/Token.py", line 59
def text(self, text:str):
^
SyntaxError: invalid syntax
Environment summary
azure-cli (2.0.45)
acr (2.1.4)
acs (2.3.2)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.3)
backup (1.2.1)
batch (3.3.3)
batchai (0.4.2)
billing (0.2.0)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.1)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.3)
core (2.0.45)
cosmosdb (0.2.1)
dla (0.2.2)
dls (0.1.1)
dms (0.1.0)
eventgrid (0.2.0)
eventhubs (0.2.3)
extension (0.2.1)
feedback (2.1.4)
find (0.2.12)
interactive (0.3.28)
iot (0.3.1)
keyvault (2.2.2)
lab (0.1.1)
monitor (0.2.3)
network (2.2.4)
nspkg (3.0.3)
profile (2.1.1)
rdbms (0.3.1)
redis (0.3.2)
reservations (0.3.2)
resource (2.1.3)
role (2.1.4)
search (0.1.1)
servicebus (0.2.2)
servicefabric (0.1.2)
sql (2.1.3)
storage (2.2.1)
telemetry (1.0.0)
vm (2.2.2)
Python location '/usr/local/bin/python'
Extensions directory '/root/.azure/cliextensions'
Python (Linux) 2.7.14 (default, Apr 27 2018, 09:45:52)
[GCC 6.4.0]
Thanks for the report. This only happens on Python 2 and is unrelated to the activity-log list command. Until it is fixed, please run the following:
pip uninstall antlr4-python3-runtime
pip install antlr4-python2-runtime
That should unblock you while we investigate.
How did you install the CLI?
When the CLI is installed it should install the correct antlr runtime. It looks like in your case it did not.
I am receiving the same issue on centos 7 when I do pip install azure-cli. I tried uninstalling and reinstalling the different antlr runtimes and did not have complete success. Anything I can provide?
If you do a pip install into a clean virtual environment followed by pip list you should only see a single runtime (for Python2). Is that not the case?
it seems like it resolved itself after reinstalling. thanks!
@tjprescott Just FYI, I've hit this issue with azure-cli 2.0.46 on macOS. Installed by running curl -L https://aka.ms/InstallAzureCli | bash as shown in https://buildazure.com/2017/05/25/install-azure-cli-2-0-on-macos/. The script creates a virtualenv in ~/lib/azure-cli.