<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Get workspace from mxd in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/get-workspace-from-mxd/m-p/666690#M51753</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:3;"&gt;&lt;PRE class="plain" name="code"&gt;import os import arcpy import xlrd&amp;nbsp; arcpy.env.overwriteOutput = True&amp;nbsp; inWS = r'C:\SampleData\XXXX\Excels' arcpy.env.workspace = inWS mxd = arcpy.mapping.MapDocument("Current")&amp;nbsp; workspaces = arcpy.ListWorkspaces() for ws in workspaces: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(ws)&amp;nbsp;&amp;nbsp; del mxd, workspaces&lt;/PRE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The FeatureClasses get from arcpy.mapping.ListLayers(mxd) but to open table the below code is using and update the attributes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:2;"&gt;&lt;PRE class="plain" name="code"&gt;arcpy.env.workspace = ws tableList = arcpy.ListTables()&lt;/PRE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please guide me how to get workspace, tablelist by using mxd in ArcGIS 10.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Johnson&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Nov 2013 11:42:06 GMT</pubDate>
    <dc:creator>M_DJohnson</dc:creator>
    <dc:date>2013-11-27T11:42:06Z</dc:date>
    <item>
      <title>Get workspace from mxd</title>
      <link>https://community.esri.com/t5/python-questions/get-workspace-from-mxd/m-p/666690#M51753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:3;"&gt;&lt;PRE class="plain" name="code"&gt;import os import arcpy import xlrd&amp;nbsp; arcpy.env.overwriteOutput = True&amp;nbsp; inWS = r'C:\SampleData\XXXX\Excels' arcpy.env.workspace = inWS mxd = arcpy.mapping.MapDocument("Current")&amp;nbsp; workspaces = arcpy.ListWorkspaces() for ws in workspaces: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(ws)&amp;nbsp;&amp;nbsp; del mxd, workspaces&lt;/PRE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The FeatureClasses get from arcpy.mapping.ListLayers(mxd) but to open table the below code is using and update the attributes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:2;"&gt;&lt;PRE class="plain" name="code"&gt;arcpy.env.workspace = ws tableList = arcpy.ListTables()&lt;/PRE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please guide me how to get workspace, tablelist by using mxd in ArcGIS 10.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Johnson&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Nov 2013 11:42:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-workspace-from-mxd/m-p/666690#M51753</guid>
      <dc:creator>M_DJohnson</dc:creator>
      <dc:date>2013-11-27T11:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get workspace from mxd</title>
      <link>https://community.esri.com/t5/python-questions/get-workspace-from-mxd/m-p/666691#M51754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The listworkspace gives all the available files in the specified folder so all inputs and pgdb are in same folder hence it return mdb file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I need to get list of tables from current mxd. Is it possible ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Johnson&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:3;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(ws)


del mxd, workspaces&lt;/PRE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;The FeatureClasses get from arcpy.mapping.ListLayers(mxd) but to open table the below code is using and update the attributes. &lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:2;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.env.workspace = ws
tableList = arcpy.ListTables()&lt;/PRE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Please guide me how to get workspace, tablelist by using mxd in ArcGIS 10.1&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Johnson&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:10:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-workspace-from-mxd/m-p/666691#M51754</guid>
      <dc:creator>M_DJohnson</dc:creator>
      <dc:date>2021-12-12T04:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get workspace from mxd</title>
      <link>https://community.esri.com/t5/python-questions/get-workspace-from-mxd/m-p/666692#M51755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The available all files are showing from the specified folder while testing in 10.1 our pgdb kept in another folder hence it is not in the list. However ListLayers return a layer and it has a property workspacepath.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Nov 2013 03:26:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-workspace-from-mxd/m-p/666692#M51755</guid>
      <dc:creator>M_DJohnson</dc:creator>
      <dc:date>2013-11-30T03:26:45Z</dc:date>
    </item>
  </channel>
</rss>

