Python in VS Code - mikedorais/python_learning GitHub Wiki
Windows
Installed DonJayamanne/pythonVSCode
From https://github.com/DonJayamanne/pythonVSCode/wiki/Linting
Had to manually create the .vscode subfolder And in it the settings.json file and manually add this:
{ "python.pythonPath": "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" }
It wants to install pylint but it fails:
PS C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3> "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python. exe" -m pip install pylint
At line:1 char:72
- ... Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" -m pip ins ...
-
~~
Unexpected token '-m' in expression or statement. At line:1 char:75
- ... s\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" -m pip install ...
-
~~~
Unexpected token 'pip' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken
That was because my terminal was PowerShell I changed it my user settings (command: Open User Settings) (C:\Users\michaeld\AppData\Roaming\Code\User\settings.json) to add this line: "terminal.integrated.shell.windows": "C:\Windows\sysnative\cmd.exe"
Then this worked (apparently once, but then it didn't later) when called from VS Code upon prompting me to install pylint. C:\TFS\TriTech-GIS\Research\Unit-Recommendation\Research_InformCADUnitRec1\Research_InformCADUnitRec1\gpscript>"C:\Program Files \ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" -m pip install pylint Collecting pylint …
It would never acknowledge that pylint was installed and kept giving me the error that it wasn't installed until I explicitly added it to the path in the settings.json file like this: "python.linting.pylintPath": "C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/Scripts/pylint.exe"
Note: After this I just added Python to the path and everything seems to work better with fewer special workarounds and settings adjustments. For a system with ArcGIS Pro installed I just put this in the path: C:\Program Files\ArcGIS\Pro\bin\Python C:\Program Files\ArcGIS\Pro\bin\Python\Scripts Now there may be an issue with Conda environments
Python in Visual Studio Code (Ubuntu)
Created Wednesday 08 March 2017
I installed the Python extension by Don Jayamanne. Recommended by an Esri employee at Esri Dev Summit 2017. https://github.com/DonJayamanne/pythonVSCode/wiki
Needed to install pylint and pylint3 and dependencies.
Getting this: ----------Generating Tags---------- ctags --options=/home/michael/.vscode/extensions/donjayamanne.python-0.5.9/resources/ctagOptions --languages=Python --exclude=/site-packages/ -o /home/michael/src/python/try-python/.vscode/tags . ctags: unrecognized option '--options=/home/michael/.vscode/extensions/donjayamanne.python-0.5.9/resources/ctagOptions' Try `ctags --help' for a complete list of options.
installed exuberant-ctags and that error went away.
command: Python: Select Workspace Interpreter. (I selected python3.5)
This created a .vscode settings.json { "python.pythonPath": "/usr/bin/python3.5" }
http://www.diveintopython3.net/your-first-python-program.html