1

I want to use VSCode as editor for my OSGEO4W development. I can write and debug and run my programm, but the "outline"-window (which is pretty necessary) on the left side is not working. When looking at the Python-Output there is the following error-message:

InvalidPythonEnvironment: Could not get version information for 'C:\\OSGEO4~1\\bin\\python.exe': InternalError(u'The subprocess C:\\OSGEO4~1\\bin\\python.exe has crashed (EOFError(), stderr=).',)

I am using this batchfile for starting VSCode:

rem @echo off
set OSGWO4W_ROOT=C:\OSGeo4W64

REM Setting HOME is necessary for VSCode
REM in order to find the global .gitignore-file
SET HOME=H:\

call "%~dp0\o4w_env.bat"
@echo off

path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\Qt4\bin
path %PATH%;%OSGEO4W_ROOT%\apps\Python27\Scripts

SET PYTHONPATH=%OSGEO4W_ROOT%\apps\python27\lib;%OSGEO4W_ROOT%\apps\python27\lib\site-packages;%OSGEO4W_ROOT%\bin;%PYSC_DIR%\Lib;C:\Users\<username>\AppData\Roaming\python\Python27\site-packages;

path %PATH%;C:\Program Files\Git\cmd
path %PATH%;C:\Program Files\Microsoft VS Code\bin
path %PATH%;C:\Program Files\dotnet\;C:\Windows\system32;c:\Windows;c\OSGeo4W64\bin;%OSGEO4W_ROOT%\


set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
set GDAL_FILENAME_IS_UTF8=YES
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE=TRUE
set VSI_CACHE_SIZE=1000000

set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qt5\plugins

path %PATH%;%OSGEO4W_ROOT%

start /d "C:\Program Files\Microsoft VS Code\" Code.exe

When using VSCode with the standard-python-installation everything works fine.

VSCode-Version: 1.47.2 Python: 2.7.16 64bit

4
  • The problem seems to arrise in the command:C:\OSGEO4~1\bin\python.exe c:\Users\<username>\.vscode\extensions\ms-python.python-2020.7.94776\pythonFiles\pyvsc-run-isolated.py pip --version Commented Jul 17, 2020 at 12:43
  • Found out, that when using the python3-environment from OSGEO4W it works. Any ideas how to make it work also with python 2.7.14? Commented Jul 17, 2020 at 13:04
  • Would you mention the way you configured this. Commented Mar 11, 2022 at 4:03
  • @rs_punia Do you mean the python-3 environment? Because the python 2 just does not work (partly works, but is not supported). Commented May 3, 2022 at 13:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.