Select to view content in your preferred language

Feature does not exist

03-24-2021 02:41 AM
New Contributor III


I am using ArcHydroTools within Python

When I run this part of the script, the” Drainage line processing tool” creates the file that I need in the needed name and path. But unfortunately, I get a warning that this file "does not exist".

And when I want to use this feature in another function, I can’t since python cannot find it, but it is created and I can use it in arcmap for example.

Any idea how can I fix the problem?

This the first part of the script, 

import os
import arcpy

arcpy.env.workspace = r"C:\Users\achour\Desktop\ArcHydro Python\Data"
arcpy.env.overwriteOutput = True
arcpy.env.addOutputsToMap = True

if arcpy.CheckExtension('Spatial') == 'Available':
from import *
print "Available"
print "Spatial analyste extension not available"

import ArcHydroToolsPy

DEM = r'C:\Users\achour\Desktop\ArcHydro Python\Data\DEM'
Fdr = r"C:\Users\achour\Desktop\ArcHydro Python\Data\fdr"
Fac = r"C:\Users\achour\Desktop\ArcHydro Python\Data\fac"
WatershedPolygone = r"C:\Users\achour\Desktop\ArcHydro Python\Layers\Subwatershed.shp"
WatershedOutlet = r"C:\Users\achour\Desktop\ArcHydro Python\Layers\SubwatershedPoint.shp"
LongestFlowPathCat = r"C:\Users\achour\Desktop\ArcHydro Python\Layers\LongestFlowPathCat.shp"

baseStr = r"C:\Users\achour\Desktop\ArcHydro Python\Data\Str"
baseStrLnk = r"C:\Users\achour\Desktop\ArcHydro Python\Data\StrLnk"
baseDrainVect = r"C:\Users\achour\Desktop\ArcHydro Python\project.gdb\DrainVect"
baseExtPoint = r"C:\Users\achour\Desktop\ArcHydro Python\Data\Extpoint"

i_iter = range(100, 1000, 100)
NumberOfExternalPoints = []
LongestThresholdPath_Liste = []
NetworkLength = []

for i,value in enumerate(i_iter):

# Process: Stream Definition
Str = ArcHydroToolsPy.StreamDefinition(Fac, i_iter[i], baseStr + str(i_iter[i]), "")

# Process: Stream Segmentation
StrLnk = ArcHydroToolsPy.StreamSegmentation(Str, Fdr, baseStrLnk + str(i_iter[i]), "", "")

# Process: Drainage Line Processing
DrainVect = ArcHydroToolsPy.DrainageLineProcessing(StrLnk, Fdr, baseDrainVect + str(i_iter[i]))

And this is the warning:

C:\Python27\ArcGIS10.8\python.exe "C:/Users/achour/Desktop/ArcHydro Python/arcpy script/"
Using threshold = 100 cells.
Executing Stream to Feature...
- Stream to Feature completed in 0.5 seconds.
Copying C:\Users\achour\AppData\Local\Temp\scratch\scratch.gdb\tmpdl into feature dataset...
- Copying completed in 0.3 seconds.
WARNING: ['line 188', 'c:\\program files (x86)\\arcgis\\desktop10.8\\ArcToolbox\\Scripts\\ArcHydro\\', 'IOError: "C:\\Users\\achour\\Desktop\\ArcHydro Python\\project.gdb\\DrainVect100" does not exist']
Cleaning completed: 0 line(s) deleted.
- Cleanup completed in 0.0 seconds.
WARNING: ['line 343', 'c:\\program files (x86)\\arcgis\\desktop10.8\\ArcToolbox\\Scripts\\ArcHydro\\', 'IOError: "C:\\Users\\achour\\Desktop\\ArcHydro Python\\project.gdb\\DrainVect100" does not exist']
Cleaning up...

Process finished with exit code 0

0 Kudos
0 Replies