Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Get workspace from mxd

$
0
0
Hi All,

I have written script to update data from excel to pgdb for ArcGIS 10 and it is working fine. We have upgraded to 10.1 recently and the script is not working. The ListWorkspaces() give the excel path as well as current workspace pgdb path but in 10.1 it is not written.

Code:

import os
import arcpy
import xlrd

arcpy.env.overwriteOutput = True

inWS = r'C:\SampleData\XXXX\Excels'
arcpy.env.workspace = inWS
mxd = arcpy.mapping.MapDocument("Current")

workspaces = arcpy.ListWorkspaces()
for ws in workspaces:
    arcpy.AddMessage(ws)


del mxd, workspaces



The FeatureClasses get from arcpy.mapping.ListLayers(mxd) but to open table the below code is using and update the attributes.

Code:

arcpy.env.workspace = ws
tableList = arcpy.ListTables()



Please guide me how to get workspace, tablelist by using mxd in ArcGIS 10.1

Regards
Johnson

Viewing all articles
Browse latest Browse all 2485

Latest Images

Trending Articles



Latest Images