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

Intellisense for Azure CLI throwing error #66

Open
rich17lucas opened this issue Mar 11, 2020 · 9 comments
Open

Intellisense for Azure CLI throwing error #66

rich17lucas opened this issue Mar 11, 2020 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@rich17lucas
Copy link

The AZ Cli plugin is not giving any Intellisense suggestions.

In the Developer Tools console I see these errors appear as I type az .

console.ts:137 [Extension Host] Fatal Python error: Py_I
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:398
_invokeHandler @ rpcProtocol.ts:383
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
(anonymous) @ rpcProtocol.ts:101
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] nitialize: can't initialize sys standard streamsTraceback (most recent call last):  File "E:\Anaconda3\lib\_bootlocale.py", line 12, in getpreferredencoding    if sys.flags.utf8_mode:AttributeError: 'sys.flags' object has no attribute 'utf8_mode'
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:398
_invokeHandler @ rpcProtocol.ts:383
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
(anonymous) @ rpcProtocol.ts:101
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Exit code 0, signal null
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:398
_invokeHandler @ rpcProtocol.ts:383
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
(anonymous) @ rpcProtocol.ts:101
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
log.ts:197   ERR Python process terminated with exit code 0, signal null.

If I create a Python file in VSCode, the Python Extension works perfectly, so this seems to be AZCLI extension specific.

Envrionment Setup
Windows 10, version 10.0.18362 Build 18362
Python: Anaconda 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]

Windows details
VSCode version 1.43.0 (user setup)
Version: 1.43.0 (user setup)
Commit: 78a4c91400152c0f27ba4d363eb56d2835f9903a
Date: 2020-03-09T19:47:57.235Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362

@chrmarti
Copy link
Contributor

Which version of the Azure CLI are you running?

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Mar 12, 2020
@rich17lucas
Copy link
Author

Hi Christof,
I installed version 0.5.0.

@chrmarti
Copy link
Contributor

@rich17lucas That must be the extension's version. What does az --version tell you?

@rich17lucas
Copy link
Author

@chrmarti Apologies. The output is:

az --version
azure-cli                          2.1.0

command-modules-nspkg              2.0.3
core                               2.1.0
nspkg                              3.0.4
telemetry                          1.0.4

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

Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]

The Python location is interesting as the error message in the VSCode console refers to the Anaconda installation on the E:

console log

@chrmarti
Copy link
Contributor

What do you get for the following in PowerShell:

& 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' -c "import sys; print('\n'.join(sys.path))"

Please upgrade to the Azure CLI 2.2.0 to make sure you are not missing any bugfixes.

@rich17lucas
Copy link
Author

Hi
The PowerShell output is here:

PS C:\Users\rnslucas> & 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' -c "import sys; print('\n'.join(sys.path))"
Failed to import the site module
Traceback (most recent call last):
  File "E:\Anaconda3\lib\site.py", line 579, in <module>
    main()
  File "E:\Anaconda3\lib\site.py", line 566, in main
    known_paths = addsitepackages(known_paths)
  File "E:\Anaconda3\lib\site.py", line 349, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "E:\Anaconda3\lib\site.py", line 207, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "E:\Anaconda3\lib\site.py", line 159, in addpackage
    f = open(fullname, "r")
  File "E:\Anaconda3\lib\_bootlocale.py", line 12, in getpreferredencoding
    if sys.flags.utf8_mode:
AttributeError: 'sys.flags' object has no attribute 'utf8_mode'
PS C:\Users\rnslucas>

This is the system path:

 $env:path -split ";"
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin
.
C:\Program Files (x86)\AMD APP\bin\x86_64
C:\Program Files (x86)\AMD APP\bin\x86
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\ProgramData\Oracle\Java\javapath
C:\Program Files\Common Files\Microsoft Shared\Windows Live
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live
C:\Program Files (x86)\VisualSVN Server\bin
c:\cygwin64\
c:\cygwin64\bin
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static
C:\Program Files (x86)\CheckPoint\fde
C:\Program Files (x86)\ZipGenius 6\
e:\Groovy\Groovy-2.4.10\bin
e:\java\current\bin
e:\grails\grails-2.4.2\bin
C:\Program Files (x86)\Windows Live\Shared
e:\Git\cmd
E:\Pololu\Maestro\bin
C:\Program Files (x86)\Plantronics\Spokes3G\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\NVIDIA Corporation\NVIDIA NGX
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\

C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
C:\Users\rnslucas\AppData\Local\Microsoft\WindowsApps
C:\Users\rnslucas\AppData\Local\Programs\Microsoft VS Code\bin
C:\Program Files (x86)\Nmap
C:\Users\rnslucas\AppData\Local\Microsoft\WindowsApps

And if I just run python from a prompt the system opens the Windows AppStore and displays Python 3.8.

@chrmarti
Copy link
Contributor

Could you change %USERPROFILE%\.vscode\extensions\ms-vscode.azurecli-0.5.0\service\az-service.bat by adding -IB to line 4 to:

@echo off
setlocal

%1 -IB %~dp0start.py %*

endlocal

and let me know if that helps?

@rich17lucas
Copy link
Author

Hi Christof,
You are a 'steely-eyed missile man'. The -IB fixed the problem. What does it do?

console_fixed log

@chrmarti
Copy link
Contributor

It runs Python in isolated mode. (Reopening for tracking.)

@chrmarti chrmarti reopened this Mar 16, 2020
@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants