AnsweredAssumed Answered

Python only works in ArcMap

Question asked by heathmanderson on Feb 25, 2015
Latest reply on Mar 5, 2015 by heathmanderson

I was working with Python in IDLE and PyScripter but for some reason can't seem to get the code to work in either.  The code only works in ArcMap.  I am probably missing something simple but can't seem to place my finger on it.  If you can help please let me know.  I know this is simple code, but I want to run this in windows task scheduler.  I really don't want to create a model, run it, then export it as a python script.  I though it would be easier to just create a python script from scratch, perhaps not.

 

import arcpy
import os

arcpy.env.overwriteOutput = True

arcpy.env.workspace = "O:\\Data\\GIS\\Dept\\Fire\\hydrants"
mxd = os.path.join(arcpy.env.workspace,"FireHydrant_Utility.mxd")
mpk = os.path.join(arcpy.env.workspace,"FireHydrant_Package.mpk")

arcpy.PackageMap_management(mxd,mpk,"CONVERT","CONVERT_ARCSDE","#","ALL","DESKTOP","NOT_REFERENCED","ALL","#","#","#")

print "Map Package Complete"

 

 

Cheers,

Heath

Outcomes