Well, the script parts were posted in the other posts that no one gave any insight into, didn't want to clutter yet another post with the same info, but I will.
This is a default, clean install on new local machines. Everything from the download (yes, burnt to a dvd). These scripts don't work on two different machines, one a clean install and the other an upgrade from 9.3.1 - so how does that fit into the picture? And yes, I use pythonwin that came from the install disk with 2.6 Python on the local machine.
Then I am using the script tool wizard to create the tool that I eventually want to add as a button on the toolbar.
Copied from previous posts:
Part of the script that I am writing is to take the geocoded results and copy them both to an existing yearly file and to a file that is stamped with the date run and the userid. Both of these will 'create' in the file geodatabase but both return the WARNING 000117: Warning empty output generated.
I have checked the spatial reference for both the copied from the original feature class and the newly created feature class and both are the SAME as the geocoded results file. I would expect to get this warning on the one that I am running fc2fc using an empty template for, but not for the one that I am appending data to a direct copy of the original. What else causes this VERY helpful warning? This was also tried with the CopyFeatures_management command as well - same results.The if..else section criteria about the arcpy.exists will be changed in the future, I just want it to work right now.
Python code snippet: (copy and paste removed the indents)
# import
import arcpy, time, datetime, getpass
#getting current time and user
now = datetime.datetime.today()
date_stamp = now.strftime("%m%d%Y")
maintid = getpass.getuser()
curyear = now.strftime("%Y")
#variables
wksp = arcpy.env.workspace = (r"j:\NewData.gdb")
mxd = arcpy.mapping.MapDocument(r"j:\mxdfiles\NewData.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
saveGeocode = arcpy.GetParameterAsText(0)
outFile = r"\FeatTable_"+maintid+"_"+date_stamp
yearlyFile = wksp+"\FeatTable"+curyear+"_"+maintid
curGeocode = wksp+outFile
templateFC = wksp+"\FCTemplate" #this is a feat class with only the structure
#Set up the env
#arcpy.env.overwriteOutput = True
if saveGeocode == 'Y' or saveGeocode == 'y':
layer2manipulate = arcpy.mapping.ListLayers(mxd,"FeatTable",df)[0]
if arcpy.Exists(layer2manipulate):
arcpy.FeatureClassToFeatureClass_conversion(templateFC,wksp,outFile)
arcpy.Append_management(layer2manipulate,yearlyFile,"NO_TEST")
arcpy.Append_management(layer2manipulate,curGeocode,"NO_TEST")
arcpy.AddMessage(r"Geocoded data has been archived (saved) for future reference.")
else:
arcpy.AddMessage(r"You must run the geocoding process first.")
else:
arcpy.AddMessage(r"Geocoding data will not be saved and will be overwritten next time.")
When attempting the composite locator - that someone else let me know doesn't work with Win7 x64, so we have worked around that by using just the street for now.
snippets of code:
CAUfile = "caufile.txt"
AddLoc1 = "PointAddressLocator"
AddLoc2 = "StreetLocator"
AddComp = "CompositeLocator"
GeoColumn = "Address Adress VISIBLE NONE"
arcpy.env.overwriteOutput = True
arcpy.GeocodeAddresses_geocoding(CAUfile,AddComp,GeoColumn,wksp+"\Geoed")
I have tried it as well with GeoColumn = "Address"
Running Win7 x64; Arc10 SP1
The PointLocator uses single field of address
StreetLocator uses Address with nothing for the City
When attempting to update the geocoded results:
mxd = arcpy.mapping.MapDocument(r"j:\mxdfiles\mxdname.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
updateLayer = arcpy.mapping.ListLayers(mxd, "TestFC", df)[0]
sourceLayer = arcpy.mapping.Layer(r"j:\test\test.lyr")
arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer)
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
Nothing happens in the arcmap window.
Yet, most of all of these lines of code when copied and pasted in the python window in the Arcmap session work. What gives?