Python problem after upgrade 10.4.1 to 10.5.1

779
9
09-28-2018 01:03 PM
BobBistrais
New Contributor III

I upgraded my Arc Desktop from 10.4.1 to 10.5.1.  I have a Python script that no longer works, specifically, an address geocode process: 

arcpy.GeocodeAddresses_geocoding(inVendorFile, address_locator, "Street ADDRESS1 VISIBLE NONE;City City VISIBLE NONE;State STATECD VISIBLE NONE;ZIP ZIPCode VISIBLE NONE", vendor_out_feature_class, "STATIC")

The script still works on another machine that still has 10.4.1.  Any suggestions?

Tags (2)
0 Kudos
9 Replies
DanPatterson_Retired
MVP Emeritus

the error message would help to rule out something to relate the data availability etc

0 Kudos
DanielHaueter
New Contributor

I may have a similar problem. I'm also in Arc 10.5.1. When I try to run the geocode command, the script ends. Everything worked as expected up until that point, then it just ends/aborts. There is no error message. When it ends, it would seem to have completed the script successfully, however, I find that it failed to geocode my address table. I can't even use a Try...Except to catch it. @

I'm used to get error messages. I'm not used to this. It's hard to figure out the problem.

0 Kudos
JoeBorgione
MVP Emeritus

Can you post your code?  I could then try it here on our 10.5.1 installs...

That should just about do it....
0 Kudos
DanielHaueter
New Contributor

import arcpy
path = "C:\\Users\\pddnh\\Documents\\ArcGIS\\"


address_table = path+"test_data.csv"
address_locator = path+"Madison Locator.loc"
geocode_result = "geocode_result"

print "Attempting to geocode..."
arcpy.GeocodeAddresses_geocoding(address_table, address_locator, "Street Address;City City;NONE NONE;Zip Zip", geocode_result, "STATIC")
print "Geocoding complete"

0 Kudos
JoeBorgione
MVP Emeritus

Here's what your code looks like when I copied it to the python syntax highlighter.( Click More on extended menu.)  I haven't had the chance to try this but the first thing that jumps out is the lack of a designated workspace.  My guess is your script is geocoding just fine but your geocode_result is going to your default geodatabase:  C:\users\yourName\documents\ArcGIS\default.gdb

import arcpy
path = "C:\\Users\\pddnh\\Documents\\ArcGIS\\"


address_table = path+"test_data.csv"
address_locator = path+"Madison Locator.loc"
geocode_result = "geocode_result"

 

print "Attempting to geocode..."
arcpy.GeocodeAddresses_geocoding(address_table, address_locator, "Street Address;City City;NONE NONE;Zip Zip", geocode_result, "STATIC")
print "Geocoding complete"
That should just about do it....
DanielHaueter
New Contributor

(Many thanks for taking a look at this. I didn't know how to add code, thanks for the tip)

I can see what you're saying, but I don't think that's what's happening. When I run this code below:

import arcpy
from arcpy import env

env.workspace = "C:\\Users\\pddnh\\Documents\\ArcGIS\\LERMS.gdb"
featureDatasetPath = "C:\\Users\\pddnh\\Documents\\ArcGIS\\LERMS.gdb\\FeatureDataset"
filePath = "C:\\Users\\pddnh\\Documents\\ArcGIS\\"

address_table = filePath+"test_data.csv"
address_locator = filePath+"Madison Locator.loc"
geocode_result = "geocode_result"

print "Attempting to geocode..."
arcpy.GeocodeAddresses_geocoding(address_table, address_locator, "Street Address;City City;NONE NONE;Zip Zip", geocode_result, "STATIC")
print "Geocoding complete"

I get the following output:

I just noticed that the shell doesn't even recognize my variable filePath. But as you can see, it outputs "Attempting to geocode..." then there is a space and it ends with no error message.

0 Kudos
DanPatterson_Retired
MVP Emeritus

How are you running the script?  filePath isn't returned by your script and if you use

>>> locals().keys()

at that command prompt in the shell, you will see what variables have been retained

0 Kudos
DanielHaueter
New Contributor

This is what I get:

>>> locals().keys()
['__builtins__', '__name__', '__doc__', '__package__']

I'm running the script from a file called Test2.py. I usually just save it and hit F5 to run it. But then it will allow me to access those variables that were set in the file. Obviously they aren't getting established in this script. I have other scripts that are working, but they aren't using the arcpy.Geocodeaddresses_geocoding() command. I've had this problem with geocoding for several months, potentially correlated with upgrading to 10.5.1.

0 Kudos
DanPatterson_Retired
MVP Emeritus

nothing is being retained, not even arcpy

why I asked is running a script from 

python C:\your path\to your\script.py

can fail because the script path contains spaces

python r'C:\your path\to your\script.py'

might work, but it looks like you are using pythonwin

You might want to load your script into a python ide if you aren't using one and load, compile and run the script from there if that isn't your workflow