SelectLayerByLocation not working after moving my script

1210
2
Jump to solution
07-26-2012 06:08 PM
GIS1
by
New Contributor II
Hi friends,

I recently moved one of my scripts from one folder to another. Well I copied it actually. After updating the source in Arc, and running the script, I get the following error:




Traceback (most recent call last):   File "U:\Tools\Toolbox\GeoPDFMaker\GeoPDFMaker.py", line 472, in <module>     selection = arcpy.SelectLayerByLocation_management(lyr, "INTERSECT", dfAsFeature, "", "NEW_SELECTION")   File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 6585, in SelectLayerByLocation     raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000368: Invalid input data. Failed to execute (SelectLayerByLocation).   Failed to execute (GeoPDFMaker). 



Any ideas why this might be happening???

Thanks!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ChristopherThompson
Occasional Contributor III
your tool is referencing two layer objects - lyr and dfAsFeature - have you gone back and looked at how you set these up to make sure that the linkages to them weren't somehow broken when you moved things around? Did you move just the script or did any of the data get moved as well (like a whole folder being copied from one place to another)... presumably the script worked before you copied it?

View solution in original post

0 Kudos
2 Replies
ChristopherThompson
Occasional Contributor III
your tool is referencing two layer objects - lyr and dfAsFeature - have you gone back and looked at how you set these up to make sure that the linkages to them weren't somehow broken when you moved things around? Did you move just the script or did any of the data get moved as well (like a whole folder being copied from one place to another)... presumably the script worked before you copied it?
0 Kudos
GIS1
by
New Contributor II
Hi Christopher,

You sir, must be some kind of genius. Alls I did was copy the script, but somehow this resulted in my templates losing their links. What confuses me even more is that the original copy (in original location) worked fine.

In any case, I went back into the templates and fixed their links and it works like a charm.

Thank you so much!
0 Kudos