I am having some trouble running arcpy in VS Code. When I run my simple test scrtipt:
import arcpy
in_shp = r'S:\CVT\ChesterfieldTwp\Data\GIS\Layers\Utilities\SanitarySewer.shp'
for field in arcpy.ListFields(in_shp):
print(field.name)
VS Code throws an error:
Exception has occurred: GeneratorExit
File "C:\Users\adoezema\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 44, in <genexpr>
if not any(e in sys.version for e in ("Continuum", "conda-forge", "Anaconda")):
File "C:\Users\adoezema\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 44, in <module>
if not any(e in sys.version for e in ("Continuum", "conda-forge", "Anaconda")):
File "C:\Users\adoezema\OneDrive - OHM Advisors\ArcTools, Models, and Scripts\Lynda Courses\Scratch.py", line 1, in <module>
import arcpy
File "C:\Users\adoezema\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\adoezema\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\adoezema\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
How do I fix this issue?
import arcpy
in your above IDE?