This issue sounds like a repeat of ArcPy function works in ArcMap Python window but not from standalone script? but I am receiving a different outcome so this is why I am posting here.
The following is a simple geocoding script that works if loaded in the arcpy window but not running outside of Arc software. There is no error when running outside of Arc and it runs all the way through with a very low yield of geocoded features.
This is an issue with all Address Locators, Composite Locators and Custom Composite locators. Currently using StreetMap Premium 2017 R2 as the source for the custom Composite_Parcel locator listed below. The only difference between the Composite_Parcel and the standard USA_2017R2_TT_CompositeZip4 ESRI install is I changed the "Derive output geometry from display fields = No" to "Derive output geometry from display fields = Yes" in the USA_2017R2TT_PointAddress locator.
# Local variables:
tbl_WM_REPAIR_LEAKS_UAT_20190325113927 = "C\\ZZZZZ\\YYYYY\\XXXXXX\\\\Test Geocode\\Test Geocode.gdb\\tbl_UAT_20190325113927"
Composite_Parcels = "C:\\ZZZZZ\\YYYYY\\XXXXXX\\Composite_Parcels"
Geo_Model_Builder = "C:\\ZZZZZ\\YYYYY\\XXXXXX\\Test Geocode.gdb\\Geo_py_script_try_2"
# Process: Geocode Addresses
print 'Started Geocoding'
arcpy.GeocodeAddresses_geocoding(tbl_WM_REPAIR_LEAKS_UAT_20190325113927, Composite_Parcels,
"Street AddrAdded VISIBLE NONE;City City VISIBLE NONE;State State VISIBLE NONE;ZIP <None> VISIBLE NONE;ZIP4 <None> VISIBLE NONE",
Geo_Model_Builder, "STATIC")
If ran outside of Arc here is the breakdown by Loc_name:
- Point Address: 285
- Null: 2278
If loaded into arcpy window in Catalog or Maps here is the breakdown by Loc_name:
- Point Address: 1830
- Street Address: 525
- StreetName: 84
- Admin Places: 122
- Null: 2
Software Specs:
- Arc 10.4.1
- Advanced License
Python:
- Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
I've tried to edit performance Search timeout of the Address Locator from 1 second to 10 seconds but this did not change the results of the output.