Python Error import arceditor

3520
3
04-07-2011 09:05 AM
MikeChancey
New Contributor II
I am trying to create a batch file to update a local file geodatabase one-way replica from an SDE server.  I created a very simple model to uncompress the file geodatabase and then sychronize changes from the SDE database to the file geodatabase.  The model seemed to run fine.  I then exported the model to python, and added it to the batch file.  When I attempt to run it, it errors out and logs the following:
_____________________________________________________

Traceback (most recent call last):
  File "C:\GeoProcessing\UpdateArcReaderData\Scripts\Step04UpdateswBillingReplica.py", line 9, in <module>
    import arceditor
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arceditor.py", line 18, in <module>
    gp.setProduct("ArcEditor")
RuntimeError: ERROR 999999: Error executing function.

_____________________________________________________


The Python script generated by the model builder export looks like this:

# ---------------------------------------------------------------------------
# Step04UpdateswBillingReplica.py
# Created on: 2011-04-07 10:57:06.00000
#   (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------

# Set the necessary product code
import arceditor


# Import arcpy module
import arcpy


# Local variables:
swRegStorm_as_MChancey___sdeprod1_sde = "Database Connections\\swRegStorm as MChancey @ sdeprod1.sde"
KCMO_swBilling_gdb = "C:\\ArcReaderData\\KCMO_SDE\\KCMO_swBilling.gdb"
Uncompressed_data = "C:\\ArcReaderData\\KCMO_SDE\\KCMO_swBilling.gdb"

# Process: Uncompress File Geodatabase Data
arcpy.UncompressFileGeodatabaseData_management(KCMO_swBilling_gdb, "")

# Process: Synchronize Changes
arcpy.SynchronizeChanges_management(swRegStorm_as_MChancey___sdeprod1_sde, "MCHANCEY.ToAR_swBilling", Uncompressed_data, "FROM_GEODATABASE1_TO_2", "IN_FAVOR_OF_GDB1", "BY_OBJECT", "DO_NOT_RECONCILE")

______________________________________________________________

Can anyone tell me why this isn't working?  I haven't modified the Python code at all, it is just as created by ArcGIS.

This is running on a PC with Windows 7 as the OS and with ArcGIS 10 with the current service pack.
Tags (2)
3 Replies
ChrisMathers
Occasional Contributor III
arceditor isnt a module you can import. you only need to import arcpy.
SteveByrd
New Contributor II
I had this same issue with trying to schedule a task with my python script, and I had to open the python code in a notepad and remove this part:

# Set the necessary product code
import arceditor

What really stinks is that this piece of code was generated by model builder when I told it to export to python, hence I never inserted it into the code myself.  This info probably needs to be a knowledge base article when trying to apply a python script through task scheduler. 

Steve Byrd
IT/GIS Specialist
Round Rock, TX
MikeChancey
New Contributor II
I have been exporting models to Python and then triggering them in simple batchfiles for quite some time.  The only model I have exported to Python that had this issue was this one with replication.  None of the others created

# Set the necessary product code
import arceditor

I got mine working by remarking out the import arceditor line.

Something has to be wrong in the export to Python portion of model builder for it to create this bogus line.
0 Kudos