Append .lyr to file geodatabase

410
1
06-04-2012 08:16 AM
KylaJacobsen
New Contributor
Hi all,
Just learning python script and was wondering if you could help me out. I've got a script that will be converting a KML to lyr and then appending it to a feature class in a file geodatabase.

import arcpy
arcpy.env.workspace = r"C:\Users\KJacobsen\Desktop\Griffiths\Griffiths.gdb"
arcpy.env.overwriteOutput = True
#import GPS files
input = r"C:\Users\KJacobsen\Desktop\Griffiths\04232012_Documents\DATA from TEDEBAYE\garmin\120418 GARMIN\CCBJ.kmz"
outputFolder = r"C:\Users\KJacobsen\Desktop\Griffiths"
lyr = arcpy.KMLToLayer_conversion(input, outputFolder, "KML3")
FC = r"C:\Users\KJacobsen\Desktop\Griffiths\Griffiths.gdb\CHAMP"
arcpy.Append_management(lyr,FC,"NO_TEST")

I'm receiving the following error and am unsure of how to proceed...
Thanks in advance,
Traceback (most recent call last):
  File "C:\Python26\ArcGIS10.0\lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript
    exec codeObject in __main__.__dict__
  File "...\Desktop\ImportData.py", line 9, in <module>
    arcpy.Append_management(lyr,FC,"NO_TEST")
  File "...\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 2965, in Append
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000349: The input parameter is not a Table View
Failed to execute (Append).
Tags (2)
0 Kudos
1 Reply
MathewCoyle
Frequent Contributor
Try
arcpy.Append_management(os.path.join(outputFolder,"KML3"),FC,"NO_TEST")


Edit: You need to import the os module for this method to work of course.
0 Kudos