arcgis python mxd a pack mpk

def onempk(fileName):
    if fileName:
        mxd = arcpy.mapping.MapDocument(fileName)
    else:
        mxd = arcpy.mapping.MapDocument("current")
        fileName=mxd.filePath
    filepath, filename = os.path.split(fileName)

    b=False
    if mxd.title==None:
        mxd.title="yl create"+filename
        b=True
    if mxd.description==None:
        mxd.description="yl auto create"+filename
        b=True
    elif mxd.description=="":
        mxd.description="yl auto create"+filename
        b=True

    if mxd.author==None:
        mxd.author="yanlei auto create"
        b=True
    if mxd.summary==None:
        mxd.summary="yanlei auto create summary"
        b=True
    if mxd.relativePaths==False:
        mxd.relativePaths=True
        b=True
    if b==True:
        mxd.save()
    arcpy.env.workspace = filepath
    mpk=filename.lower().replace(".mxd",".mpk")

    #arcpy.AddMessage("mpk:"+mpk+","+mpk[0:1])
    if (is_number(mpk[0:1])):
        mpk="YL_"MPK + # mail attachments can not start with a number 

    arcpy.PackageMap_management (filename, MPK, " PRESERVE " , " # " , " # " , " ALL " )
     return filepath + + MPK os.sep

 

Guess you like

Origin www.cnblogs.com/gisoracle/p/11388971.html