Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding: utf-8
- import arcpy
- import _csv
- import os
- import sys
- arcpy.env.workspace = "F:/全国省级、地市级、县市级行政区划shp/全国省级、地市级、县市级行政区划shp/New Personal Geodatabase.mdb"
- input = "F:/New Personal Geodatabase.mdb/Province"
- inputField = "OBJECTID"
- matchTable = r"F:matchtable.csv"
- matchField = "OBJECTID"
- pathField = "Picture"
- picFolder = r"F:MGS"
- writer = _csv.writer(open(matchTable, "wb"), delimiter=",")
- writer.writerow([matchField, pathField])
- for file in os.listdir(picFolder):
- if str(file).find(".jpg") > -1:
- writer.writerow([str(file).replace(".jpg", ""), file])
- del writer
- arcpy.EnableAttachments_management(input)
- arcpy.AddAttachments_management(input, inputField, matchTable, matchField, pathField, picFolder)
- Traceback (most recent call last):
- File "F:/���ֿμ���������/ʵϰ/ArcPy Sandbox/AutomateScript/BatchAddAttribute.py", line 29, in <module>
- arcpy.AddAttachments_management(input, inputField, matchTable, matchField, pathField, picFolder)
- File "F:ArcGIS 10.2.1Engine10.2arcpyarcpymanagement.py", line 124, in AddAttachments
- raise e
- arcgisscripting.ExecuteError: ERROR 000228: Cannot open the dataset.
- Failed to execute (AddAttachments).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement