Select to view content in your preferred language

Python script runs perfect on local machine- FAILS running on server

4532
4
Jump to solution
04-03-2015 11:34 AM
AlicePence
Frequent Contributor

Doing a simple geocoding script from a SQL table to Feature Class. When I run it on my local machine everything runs fine- then when I try it on my server (virtual machine) I get this error:

Traceback (most recent call last):
  File "C:\scripts\PropertyListings\properties2.py", line 43, in <module>
    arcpy.GeocodeAddresses_geocoding(web_forms_dbo_v_GISPropertyImport, City_of_Auburn_Linear, "Street ADDRESS VISIBLE NONE", sde_master_GIS_USER_PropertyListings, "STATIC")
  File "D:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geocoding.py", line 194, in GeocodeAddresses
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Table: Dataset Databas
e Connections\Webforms@AUBPM01.sde\web_forms.dbo.v_GISPropertyImport does not exist or is not supported
Failed to execute (GeocodeAddresses).

Here's part of my script:

# Import arcpy module
import arcpy
import sys
import string
import smtplib
import pyodbc
import traceback
import time


# Set the Date
Date = time.strftime("%m-%d-%Y", time.localtime())


# Set the time
Time = time.strftime("%I:%M:%S %p", time.localtime())


# Set Environment Variables
arcpy.env.overwriteOutput = True


print "Process started at " + str(Date) + " " + str(Time) + "." + "\n" #Log File Start Time.


# Set up the log file.
LogFile = file('C:\\Temp\\CommercialPropertyImportLog' + '.txt', 'w') #Creates a log file with todays date.
output = open('C:\\Temp\\CommercialPropertyImportLog' + '.txt', 'w') #Path to log file.
output.write(str("Process started at " + str(Date) + " " + str(Time) + "." + "\n")) # Write the start time to the log file.




# Local variables:
web_forms_dbo_v_GISPropertyImport = "Database Connections\\Webforms@AUBPM01.sde\\web_forms.dbo.v_GISPropertyImport"
City_of_Auburn_Linear = "O:\\GeoData\\Databases\\Geocoding.gdb\\City of Auburn Linear"
sde_master_GIS_USER_PropertyListings = "Database Connections\\gis_user@sde_master.sde\\sde_master.GIS_USER.EconomicDevelopment\\sde_master.GIS_USER.PropertyListings"


try:
    print "Starting Geocoding"
    # Process: Geocode Addresses
    arcpy.GeocodeAddresses_geocoding(web_forms_dbo_v_GISPropertyImport, City_of_Auburn_Linear, "Street ADDRESS VISIBLE NONE", sde_master_GIS_USER_PropertyListings, "STATIC")

Thanks!

0 Kudos
1 Solution

Accepted Solutions
MichaelMiller2
Frequent Contributor

Probably has something to do with you drive letters. On the server it does not know where to find your “C” and “D” drives. Need to use UNC paths instead. Just my guess.

Michael

View solution in original post

0 Kudos
4 Replies
MichaelMiller2
Frequent Contributor

Probably has something to do with you drive letters. On the server it does not know where to find your “C” and “D” drives. Need to use UNC paths instead. Just my guess.

Michael

0 Kudos
JamesCrandall
MVP Frequent Contributor

In addition to what Michael said, also check your .sde connection files exist where you set your Local variables.

AndrewBrown
Deactivated User

Alice, I agree with both Michael and James.  When executing your python script on AGS, it is expecting to find sde connections and drives that are unique to your local computer.

Your ArcGIS server probably doesn't have an O:\ Drive and it probably doesn't have ArcGIS desktop installed, which is how the Database Connections\\gis_user@sde_master.sde\\  path was created.

To work around this, you can create a network share, copy your sde connections into that folder and give ArcGIS server permissions to it.

Then, in your python script, reference the UNC paths that Michael mentioned for the paths to your data instead of your unique local paths.

AlicePence
Frequent Contributor

That worked! Thanks Michael Miller​ for the path name suggestions - that's what was holding it up.

0 Kudos