<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error message even though script finishes with expected results. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282908#M21820</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@Wayne, thanks.. I tried it both ways.. this time it ran through the process and executed the xytoline_management tool..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I checked the env and it was correct this time.. thanks for the heads up.. :0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;anyways, the tool ran and the csv was converted to lines.. but then it threw another error.. same as the first..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is the error message...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Traceback (most recent call last):
&amp;nbsp; File "C:\temp\GIS_projects\Sample_tripData\test.py", line 22, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(input_table,fc,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")
&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 2913, in XYToLine
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e
ExecuteError: ERROR 999999: Error executing function.
The table was not found. [tripLines]
Failed to execute (XYToLine).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is my new updated code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import arcinfo
import arcpy
import sys
if arcpy.CheckProduct("ArcInfo") == "Available":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo available, processing script..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "importing modules and set environment...."

&amp;nbsp;&amp;nbsp;&amp;nbsp; #overwrite pre-existing files
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = True

&amp;nbsp;&amp;nbsp;&amp;nbsp; #set workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = "tripLines"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "setting data input and output variables..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; input_table = "C:\\temp\\GIS_projects\\Sample_tripData\\A6_TEMP_ATL_TRIP_HAULx.csv"

&amp;nbsp;&amp;nbsp;&amp;nbsp; #XY To Line
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "running XY to Line Geoprocessing tool..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(input_table,fc,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process to delete identical line features...
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the field upon which the identicals are found
&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = "Shape;TRIPSEQNUM;Shape_Length"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the XY tolerance within which to identical records to be deleted
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy_tol = "0.0002 Miles"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the Z tolerance to default
&amp;nbsp;&amp;nbsp;&amp;nbsp; z_tol = "0"

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Deleteing identical features..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Execute Delete Identical 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteIdentical_management(fc, fields, xy_tol, z_tol)

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Dropping leading character..."

&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.UpdateCursor(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; field = "TRIPSEQNUM"
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set value of field to only those values after the zero value location
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I want to strip off the first character within the value of the field
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(field, row.getValue(field)[0:])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()

&amp;nbsp;&amp;nbsp;&amp;nbsp; del fc, input_table, row, cursor, out_lines, input_table, field

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Processing Complete!"

else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo license not available"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit("ArcInfo license not available")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 13:41:57 GMT</pubDate>
    <dc:creator>AlexGray</dc:creator>
    <dc:date>2021-12-11T13:41:57Z</dc:date>
    <item>
      <title>Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282902#M21814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am working on a script trying to plot lines from csv point data file..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It all seems to work until the end where I get an error stating that the table is not found..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when I open the FC in the map view, I see that I am getting the result I was expecting.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any help would be greatly appreciated..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is the error...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Traceback (most recent call last): &amp;nbsp; File "C:\temp\GIS_projects\Sample_tripData\test.py", line 27, in &amp;lt;module&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; "TELATDD","GEODESIC","TRIPSEQNUM") &amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 2913, in XYToLine &amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError: ERROR 999999: Error executing function. The table was not found. [trip_lines] Failed to execute (XYToLine).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is my code.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Import system modules import arcpy print "importing modules and set environment...." from arcpy import env env.workspace = "c:/temp/gis_projects/sample_tripdata/test.gdb" fc = "trip_lines" #overwrite pre-existing files arcpy.env.overwriteOutput = True&amp;nbsp; # Set local variables print "setting data input and output variables..." input_table = "C:/temp/GIS_projects/Sample_tripData/A6_TEMP_ATL_TRIP_HAULx.csv"&amp;nbsp; # check to see if FC exists, if so, delete. if arcpy.Exists(fc): &amp;nbsp;&amp;nbsp;&amp;nbsp; print "trip_lines exists..." &amp;nbsp;&amp;nbsp;&amp;nbsp; print "deleting trip_lines..." &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(fc) &amp;nbsp;&amp;nbsp;&amp;nbsp; print "trip_lines deleted..."&amp;nbsp; out_lines = "C:/temp/GIS_projects/Sample_tripData/test.gdb/trip_lines"&amp;nbsp; #XY To Line print "running XY to Line Geoprocesseing tool..." arcpy.XYToLine_management(input_table,out_lines, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "TSLONGDD","TSLATDD","TELONGDD", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "TELATDD","GEODESIC","TRIPSEQNUM") &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 17:08:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282902#M21814</guid>
      <dc:creator>AlexGray</dc:creator>
      <dc:date>2013-06-06T17:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282903#M21815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your code looks good to me...I am guessing there is something wrong with your path. When you set your environment, you have the some things capitalized...But then when you have your table path the capitalization does not match...Case matters in Python. Is this supposed to be lowercase?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Import system modules
import arcpy
print "importing modules and set environment...."
from arcpy import env
env.workspace = "c:/temp/gis_projects/sample_tripdata/test.gdb"
fc = "trip_lines"
#overwrite pre-existing files
arcpy.env.overwriteOutput = True

# Set local variables
print "setting data input and output variables..."
input_table = "C:/temp/GIS_projects/Sample_tripData/A6_TEMP_ATL_TRIP_HAULx.csv"

# check to see if FC exists, if so, delete.
if arcpy.Exists(fc):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "trip_lines exists..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "deleting trip_lines..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "trip_lines deleted..."

out_lines = "C:/temp/GIS_projects/Sample_tripData/test.gdb/trip_lines"

#XY To Line
print "running XY to Line Geoprocesseing tool..."
arcpy.XYToLine_management(input_table,out_lines,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "TSLONGDD","TSLATDD","TELONGDD",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "TELATDD","GEODESIC","TRIPSEQNUM")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would double check the paths to make sure you have it capitalized correctly. Also, I find that it is easier to specify your paths this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
r'G:\PROJECTS\Cedar\GeneralScripts\PyLibrary'
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;By inserting the "r" in front of single/double quotes, you can cast it as a raw string. When you do this you do not have to worry about escape characters and shortcuts. You can simply copy and paste the path inside the r' ' and you don't have to worry about changing your backslashes to double backslashes or forward slashes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:17:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282903#M21815</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T16:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282904#M21816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure, but could be due to not using "pytonic" paths.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
out_lines = r"C:\temp\GIS_projects\Sample_tripData\test.gdb\trip_lines"

or

out_lines = "C:\\temp\\GIS_projects\\Sample_tripData\\test.gdb\\trip_lines"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282904#M21816</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T13:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282905#M21817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You've already set the workspace you intend to write your output to which you named with your variable 'fc'... So 'output_lines' is redundant.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Should be able to get rid of the line where you set the 'output_lines' variable; simply substitute fc...like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.XYToLine_management(input_table, fc, ....etc., etc....)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...and ditto what Rhett said about pathnames.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 20:56:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282905#M21817</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-06-06T20:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282906#M21818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, I've made the changes to the script that @Zufelt and @Wayne have mentioned..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yet, I am still getting an error.. this time says "Cannot create Featureclass TripLines"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could it be that I'm not specifying the license?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is the error message...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Traceback (most recent call last):
&amp;nbsp; File "C:\temp\GIS_projects\Sample_tripData\test.py", line 20, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(input_table,fc,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")
&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 2913, in XYToLine
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e
ExecuteError: ERROR 000206: Cannot create FeatureClass tripLines
Failed to execute (XYToLine).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is my modified code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import arcpy
from arcpy import env

print "importing modules and set environment...."

#overwrite pre-existing files
arcpy.env.overwriteOutput = True

#set workspace
env.workspace = "c:\temp\gis_projects\sample_tripdata\test.gdb"
fc = "tripLines"

# Set local variables
print "setting data input and output variables..."
input_table = r"C:\temp\GIS_projects\Sample_tripData\A6_TEMP_ATL_TRIP_HAULx.csv"

#XY To Line
print "running XY to Line Geoprocessing tool..."
arcpy.XYToLine_management(input_table,fc,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")

# Process to delete identical line features...
# Set the field upon which the identicals are found
fields = "Shape;TRIPSEQNUM;Shape_Length"

# Set the XY tolerance within which to identical records to be deleted
xy_tol = "0.0002 Miles"

# Set the Z tolerance to default
z_tol = "0"

print "Deleteing identical features..."
# Execute Delete Identical 
arcpy.DeleteIdentical_management(fc, fields, xy_tol, z_tol)

print "Dropping leading character..."

cursor = arcpy.UpdateCursor(fc)
field = "TRIPSEQNUM"
row = cursor.next()
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # set value of field to only those values after the zero value location
&amp;nbsp;&amp;nbsp;&amp;nbsp; # I want to strip off the first character within the value of the field
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(field, row.getValue(field)[0:])
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()

del fc, input_table, row, cursor, out_lines, input_table, field

print "Processing Complete!"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:41:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282906#M21818</guid>
      <dc:creator>AlexGray</dc:creator>
      <dc:date>2021-12-11T13:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282907#M21819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Apply the pathname convention to all your pathnames -- your workspace var pathname is wrong because "\t" is interpreted by python as a tab, see the test below, the 'jump' after the colon and again at the gdb name - this is invalid:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; testPathname = "c:\temp\gis_projects\sample_tripdata\test.gdb"
&amp;gt;&amp;gt;&amp;gt; print testPathname
c: emp\gis_projects\sample_tripdata est.gdb
&amp;gt;&amp;gt;&amp;gt; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Almost had it, try again!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The difference with 'r':&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; testPathname = r"c:\temp\gis_projects\sample_tripdata\test.gdb"
&amp;gt;&amp;gt;&amp;gt; print testPathname
c:\temp\gis_projects\sample_tripdata\test.gdb
&amp;gt;&amp;gt;&amp;gt; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282907#M21819</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-11T13:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282908#M21820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@Wayne, thanks.. I tried it both ways.. this time it ran through the process and executed the xytoline_management tool..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I checked the env and it was correct this time.. thanks for the heads up.. :0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;anyways, the tool ran and the csv was converted to lines.. but then it threw another error.. same as the first..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is the error message...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Traceback (most recent call last):
&amp;nbsp; File "C:\temp\GIS_projects\Sample_tripData\test.py", line 22, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(input_table,fc,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")
&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 2913, in XYToLine
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e
ExecuteError: ERROR 999999: Error executing function.
The table was not found. [tripLines]
Failed to execute (XYToLine).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is my new updated code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import arcinfo
import arcpy
import sys
if arcpy.CheckProduct("ArcInfo") == "Available":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo available, processing script..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "importing modules and set environment...."

&amp;nbsp;&amp;nbsp;&amp;nbsp; #overwrite pre-existing files
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = True

&amp;nbsp;&amp;nbsp;&amp;nbsp; #set workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = "tripLines"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "setting data input and output variables..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; input_table = "C:\\temp\\GIS_projects\\Sample_tripData\\A6_TEMP_ATL_TRIP_HAULx.csv"

&amp;nbsp;&amp;nbsp;&amp;nbsp; #XY To Line
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "running XY to Line Geoprocessing tool..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(input_table,fc,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process to delete identical line features...
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the field upon which the identicals are found
&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = "Shape;TRIPSEQNUM;Shape_Length"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the XY tolerance within which to identical records to be deleted
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy_tol = "0.0002 Miles"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the Z tolerance to default
&amp;nbsp;&amp;nbsp;&amp;nbsp; z_tol = "0"

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Deleteing identical features..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Execute Delete Identical 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteIdentical_management(fc, fields, xy_tol, z_tol)

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Dropping leading character..."

&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.UpdateCursor(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; field = "TRIPSEQNUM"
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set value of field to only those values after the zero value location
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I want to strip off the first character within the value of the field
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(field, row.getValue(field)[0:])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()

&amp;nbsp;&amp;nbsp;&amp;nbsp; del fc, input_table, row, cursor, out_lines, input_table, field

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Processing Complete!"

else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo license not available"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit("ArcInfo license not available")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:41:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282908#M21820</guid>
      <dc:creator>AlexGray</dc:creator>
      <dc:date>2021-12-11T13:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282909#M21821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am not certain, but did notice your spatial reference parameter is not set... you should try specifying that.&amp;nbsp; Sorry that's all I can think of that looks suspicious to me - oh, and I'd also avoid writing to the temp directory.&amp;nbsp; The 'table not found' error can be sort of cryptic...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are still having difficulty, you can try attaching a portion of your csv (or all if small enough to attach here) and I'll see what I can do with it later, possibly tomorrow...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was curious for you to test something - see what happens if you can specify shapefile output.&amp;nbsp; This may not be allowed for this tool.&amp;nbsp; You can set up a different kind of test to see if you can make an event layer out of the point coordinates, then copy to a shapefile... not sure, but if you can do this to create shapefile output but not file gdb output, chances are the spatial reference is problematic.&amp;nbsp; Again, just guessing without experimenting.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 21:43:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282909#M21821</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-06-07T21:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282910#M21822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; @Wayne, thanks.. I tried it both ways.. this time it ran through the process and executed the xytoline_management tool..&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;I checked the env and it was correct this time.. thanks for the heads up.. :0)&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;anyways, the tool ran and the csv was converted to lines.. but then it threw another error.. same as the first..&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;here is the error message...&amp;nbsp; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;Traceback (most recent call last):
&amp;nbsp; File "C:\temp\GIS_projects\Sample_tripData\test.py", line 22, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(input_table,fc,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")
&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 2913, in XYToLine
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e
ExecuteError: ERROR 999999: Error executing function.
The table was not found. [tripLines]
Failed to execute (XYToLine).&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;here is my new updated code...&amp;nbsp; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import arcinfo
import arcpy
import sys
if arcpy.CheckProduct("ArcInfo") == "Available":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo available, processing script..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "importing modules and set environment...."

&amp;nbsp;&amp;nbsp;&amp;nbsp; #overwrite pre-existing files
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = True

&amp;nbsp;&amp;nbsp;&amp;nbsp; #set workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = "tripLines"

&lt;SPAN style="color:&amp;quot;#0000FF&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(fc):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(fc, "FeatureClass")&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;featclass = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb\\tripLines"&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "setting data input and output variables..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; input_table = "C:\\temp\\GIS_projects\\Sample_tripData\\A6_TEMP_ATL_TRIP_HAULx.csv"

&amp;nbsp;&amp;nbsp;&amp;nbsp; #XY To Line
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "running XY to Line Geoprocessing tool..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(input_table,&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;featclass&lt;/SPAN&gt;,"TSLONGDD","TSLATDD","TELONGDD","TELATDD","GEODESIC","TRIPSEQNUM")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process to delete identical line features...
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the field upon which the identicals are found
&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = "Shape;TRIPSEQNUM;Shape_Length"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the XY tolerance within which to identical records to be deleted
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy_tol = "0.0002 Miles"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the Z tolerance to default
&amp;nbsp;&amp;nbsp;&amp;nbsp; z_tol = "0"

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Deleteing identical features..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Execute Delete Identical 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteIdentical_management(fc, fields, xy_tol, z_tol)

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Dropping leading character..."

&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.UpdateCursor(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; field = "TRIPSEQNUM"
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set value of field to only those values after the zero value location
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I want to strip off the first character within the value of the field
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(field, row.getValue(field)[0:])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()

&amp;nbsp;&amp;nbsp;&amp;nbsp; del fc, input_table, row, cursor, out_lines, input_table, field

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Processing Complete!"

else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo license not available"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit("ArcInfo license not available")
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What happens if you make the above change in blue?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that doesn't work, what happens if you make the changes above in red?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:41:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282910#M21822</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T13:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282911#M21823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am not certain, but did notice your spatial reference parameter is not set... you should try specifying that.&amp;nbsp; Sorry that's all I can think of that looks suspicious to me - oh, and I'd also avoid writing to the temp directory.&amp;nbsp; The 'table not found' error can be sort of cryptic...&lt;BR /&gt;If you are still having difficulty, you can try attaching a portion of your csv (or all if small enough to attach here) and I'll see what I can do with it later, possibly tomorrow...&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Wayne&lt;BR /&gt;&lt;BR /&gt;EDIT&lt;BR /&gt;I was curious for you to test something - see what happens if you can specify shapefile output.&amp;nbsp; This may not be allowed for this tool.&amp;nbsp; You can set up a different kind of test to see if you can make an event layer out of the point coordinates, then copy to a shapefile... not sure, but if you can do this to create shapefile output but not file gdb output, chances are the spatial reference is problematic.&amp;nbsp; Again, just guessing without experimenting.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; As it turns out, the script runs, although I did add the spatial reference.. I looked into the shapefile output.. but it looks as though the tool only outputs a feature class. I think I found the problem though, and it wasn't the script per sa.. I found that some of the entries in the csv file I was using had some empty cells in the data fields I was using. So, the short of it is that I needed to make sure my data was complete and didn't include Null values.. A little embarrassing.. Thanks for your help on this though.. really appreciate the effort.. now I need to figure out how to get it to check for null values..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is the updated code... &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import arcinfo
import arcpy
import sys
if arcpy.CheckProduct("ArcInfo") == "Available":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo available, processing script..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "importing modules and setting environment...."

&amp;nbsp;&amp;nbsp;&amp;nbsp; #overwrite pre-existing files
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = True

&amp;nbsp;&amp;nbsp;&amp;nbsp; #delete old feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp; #if&amp;nbsp; arcpy.Exists("c:\\temp\\gis_projects\\sample_tripdata\\test.gdb\\haulLines"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.Delete_management ("c:\\temp\\gis_projects\\sample_tripdata\\test.gdb\\haulLines")

&amp;nbsp;&amp;nbsp;&amp;nbsp; #set workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb\\haulLines"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldName = "HaulSeqNum"
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "gathering input table data...."
&amp;nbsp;&amp;nbsp;&amp;nbsp; input_table = "C:\\temp\\GIS_projects\\Sample_tripData\\TEST_HAUL_DATA.csv"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # tool variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "setting up variables for XY to Line management tool..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; in_table = input_table
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_featureclass = fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; startx_field = "DLONGDD"
&amp;nbsp;&amp;nbsp;&amp;nbsp; starty_field = "DLATDD"
&amp;nbsp;&amp;nbsp;&amp;nbsp; endx_field = "RLONGDD"
&amp;nbsp;&amp;nbsp;&amp;nbsp; endy_field = "RLATDD"
&amp;nbsp;&amp;nbsp;&amp;nbsp; line_type = "GEODESIC"
&amp;nbsp;&amp;nbsp;&amp;nbsp; id_field = fieldName
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "setting the spatial reference..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; spatialRef = arcpy.SpatialReference("C:\\temp\\GIS_projects\\Sample_tripData\\TRIPs_GOA_STAT7.prj")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #XY To Line
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "running XY to Line Geoprocessing tool..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.XYToLine_management(in_table, out_featureclass, startx_field, starty_field, endx_field, endy_field,line_type,id_field,spatialRef)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process to delete identical line features...
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the field upon which the identicals are found
&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = '"Shape;' + fieldName + ';Shape_Length"'

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the XY tolerance within which to identical records to be deleted
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy_tol = "0.0002 Miles"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the Z tolerance to default
&amp;nbsp;&amp;nbsp;&amp;nbsp; z_tol = "0"

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Deleteing identical features..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Execute Delete Identical 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteIdentical_management(fc, fields, xy_tol, z_tol)

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Dropping leading character..."

&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.UpdateCursor(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; field = fieldName
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set value of field to only those values after the zero value location
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I want to strip off the first character within the value of the field
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(field, row.getValue(field)[1:])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.next()

&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Processing Complete!"

else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ArcInfo license not available"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit("ArcInfo license not available")

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:42:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282911#M21823</guid>
      <dc:creator>AlexGray</dc:creator>
      <dc:date>2021-12-11T13:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282912#M21824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Very well sounds good, you are on track.&amp;nbsp; That's all that matters - knowing what/where to troubleshoot is more than half the battle!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I may suggest this, based on what you said you may want to insert an 'intermediate' geoprocessing step where you write to a new table for better input into your tool...a kind of 'clean' processing for your csv.&amp;nbsp; You could potentially do this with cursor processing, looping on your csv to writing to, say, a gdb table.&amp;nbsp; Couple that with a 'try-except' within the loop to write the lineno for faulty lines to check, writing all the 'good' lines to the table.&amp;nbsp; When you correct the 'bad' lines, you can append them.&amp;nbsp; ....or, if you know how to handle them in the code, just correct them all in the same process.&amp;nbsp; But if easier, it would probably greatly help to at least know the lines that need your attention.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2013 16:07:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282912#M21824</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-06-11T16:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282913#M21825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Wayne,&lt;BR /&gt;&lt;BR /&gt; now I need to figure out how to get it to check for null values..&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could probably do a TableToTable_conversion on your input file.&amp;nbsp; the TableToTable allows an expression so you could only copy the rows without nulls/blanks to the new table (possibly in memory) and use that table for your input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just a thought that doesn't need an if/then statement for each iteration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2013 16:23:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282913#M21825</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-06-11T16:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282914#M21826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Could probably do a TableToTable_conversion on your input file.&amp;nbsp; the TableToTable allows an expression so you could only copy the rows without nulls/blanks to the new table (possibly in memory) and use that table for your input.&lt;BR /&gt;&lt;BR /&gt;Just a thought that doesn't need an if/then statement for each iteration.&lt;BR /&gt;&lt;BR /&gt;R_&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;yeah, that is what I've done.. but it would be nice to know where the nulls are or how many there are..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working on trying to figure out how to run a cursor and check values..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but for now this works..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I first convert the csv file to a table within a gdb and then convert the gdb table to another table minus the nulls..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;here is the code.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#convert csv to table
&amp;nbsp;&amp;nbsp;&amp;nbsp; table1 = "C:\\temp\\GIS_projects\\Sample_tripData\\TEST_HAUL_DATA.csv"
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb"
&amp;nbsp;&amp;nbsp;&amp;nbsp; table2 = "testHaul"
&amp;nbsp;&amp;nbsp;&amp;nbsp; table3 = "cleantestHaul"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldName = "HaulSeqNum"
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Converting CSV table to GDB table..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.TableToTable_conversion(table1, gdb, table2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = arcpy.AddFieldDelimiters(arcpy.env.workspace, "DLONGDD") + " IS NOT NULL"
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Excluding null values..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.TableToTable_conversion(table2, gdb, table3,expression)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = "c:\\temp\\gis_projects\\sample_tripdata\\test.gdb\\haulLines"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks..&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:42:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282914#M21826</guid>
      <dc:creator>AlexGray</dc:creator>
      <dc:date>2021-12-11T13:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282915#M21827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You could do something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
# Overwrite pre-existing files
arcpy.env.overwriteOutput = True

# Local variables:


test_csv = "D:\\baks\\dont_use\\test.csv"
in_memory = "in_memory"
temp_gdb = "D:\\baks\\dont_use\\temp.gdb"
testHaul = "in_memory\\testHaul"

# Process: Table to Table
arcpy.TableToTable_conversion(test_csv, in_memory, "testHaul")

arcpy.TableToTable_conversion(testHaul, temp_gdb, "testHaul_nonnull", "\"COMMENT\" IS NOT NULL AND \"COMMENT\" &amp;lt;&amp;gt; '' AND \"COMMENT\" &amp;lt;&amp;gt; ' '")

arcpy.TableToTable_conversion(testHaul, temp_gdb, "testHaul_nulls", "\"COMMENT\" IS NULL OR \"COMMENT\" = '' OR \"COMMENT\" = ' '")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;which would put your temp table in memory, which is much faster (since the expressions doesn't appear to work in table2table with csv files....another bug??), then convert to FGDB table using the expression on the second table2table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My data, COMMENT is the field I am testing for NULL.&amp;nbsp; Actually, my expression tests if NULL, or if equal to blank or if equal to single space (all not valid data).&amp;nbsp; So, when run, I get one table "testHaul_nonnull" with the all rows where COMMENT is not Null or blank.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The last TableToTable is basically a reverse of the expression of the one before it.&amp;nbsp; So, it will make a new table with all rows with COMMENT = null, blank, and single space as a new table with testHaul_nulls.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could also iterate through and use a cursor, put expression on the cursor, etc., but I think that would take longer.&amp;nbsp; the above seems like a quick/easy way to get both the non nulls to a "clean" table you can use for input as well as a table with all the "errors" that were stripped out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:42:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282915#M21827</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T13:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282916#M21828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rhett's approach is clean, I like it...this is just additional info, a little late, but here it is--- basically, a None type obj is returned by python...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can access a csv with an arcpy search cursor as shown below, possibly with the 'data access' search cursor (arcpy.da.searchcursor).&amp;nbsp; The below is a simple demo from 10.0 (da is new at 10.1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my 'junk' csv file contents, set up just for this demo:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
field0,field1,field2,field3
1254,text,1258,562
,,,
 ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 
99.99,, 515, 621&amp;nbsp;&amp;nbsp; 
5424,mytext,2301.123,562
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...and this is the simple code (entered from IDLE) showing cursor access (just printing to the screen):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; arcpy.env.workspace = r'C:\Documents and Settings\whitley-wayne\Desktop'

&amp;gt;&amp;gt;&amp;gt; CSV = 'testCSV1.csv'

&amp;gt;&amp;gt;&amp;gt; fields = arcpy.ListFields(CSV)

&amp;gt;&amp;gt;&amp;gt; rows = arcpy.SearchCursor(CSV)

&amp;gt;&amp;gt;&amp;gt; lineTXT = ''

&amp;gt;&amp;gt;&amp;gt; for row in rows:
 for fieldObj in fields:
&amp;nbsp; lineTXT += '\'' + str(row.getValue(fieldObj.name))+ '\'\t'
 print lineTXT
 lineTXT = ''

 
'1254.0' 'text' '1258.0' '562' 
'None' 'None' 'None' 'None' 
'None' 'None' 'None' 'None' 
'99.99' 'None' '515.0' '621' 
'5424.0' 'mytext' '2301.123' '562' 
&amp;gt;&amp;gt;&amp;gt;&amp;nbsp; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, that was short and sweet - maybe that'll help in getting started with cursors...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And by the way, the analogous test for Null in Python simply use the keyword None (no quotes), i.e., in an 'if' statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
if row.getValue(field) is None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # then do something, for example...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myFlag = True
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:42:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282916#M21828</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-11T13:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error message even though script finishes with expected results.</title>
      <link>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282917#M21829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am getting the same error when running the XY to Line tool directly in ArcMap using a table in a file geodatabase.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 16:54:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-message-even-though-script-finishes-with/m-p/282917#M21829</guid>
      <dc:creator>KeithMcKinnon2</dc:creator>
      <dc:date>2014-08-11T16:54:03Z</dc:date>
    </item>
  </channel>
</rss>

