<?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 Python Window: The workspace is not connected in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-window-the-workspace-is-not-connected/m-p/1220527#M65815</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;As I am doing layout design with&amp;nbsp;&lt;STRONG&gt;arcpy.mp&lt;/STRONG&gt; in AGP 3.0, I'm experiencing the misfortune of having to use the Python Window instead of a reliable IDE like PyCharm. The latest problem: when I need to create a new layout and pull data from another file geodatabase, setting the workspace seems to have no effect, and using &lt;STRONG&gt;arcpy.da.SearchCursor()&lt;/STRONG&gt; consistently throws a &lt;EM&gt;RunTimeError: The workspace is not connected.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;circ = 'AOI'
dlDate = '10102022'

arcpy.env.workspace = fr"D:\myPath\{circ}_{dlDate}.gdb"
cGDB = arcpy.env.workspace
arcpy.env.overwriteOutput = True

print(cGDB)

MBfcs = arcpy.ListFeatureClasses()
MBtbs = arcpy.ListTables()
MBSurtb = MBtbs[0]

surFields = [f.name for f in arcpy.ListFields(MBSurtb)]
print(surFields)

with arcpy.da.SearchCursor(MBSurtb, surFields) as tableParser:
    for row in tableParser:
        fctyID = row[1]
        totSTR = row[3]
        subStr = row[4]
        subAdd = row[8]
        nonStr = row[6]
        wTxStr = row[10]
        totSpn = row[11]
        circMi = row[12]
        condMi = row[14]
        nCrcMi = row[15]
        nonSpn = row[16]
        datMin = row[17][4:]
        datMax = row[18][4:]
        fyrMin = row[17][:4]
        fyrMax = row[18][:4]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results:&lt;BR /&gt;D:\myPath\AOI_10102022.gdb&lt;BR /&gt;['OBJECTID', 'field1', 'field2', 'field3', 'field4', 'field5', 'field6', 'field7', 'field8', 'field9', 'field10', 'field11', 'field12', 'field13', 'field14', 'field15', 'field16', 'field17', 'field18']&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 26, in &amp;lt;module&amp;gt;&lt;BR /&gt;RuntimeError: The workspace is not connected.&lt;BR /&gt;&lt;BR /&gt;I've tried compacting the geodatabase as a first step to remove any locks, removing my &lt;STRONG&gt;with&lt;/STRONG&gt; statement for the search cursor, everything. It's seems like I can't redeclare variables? What could be happening here?&lt;BR /&gt;&lt;BR /&gt;The behavior of the Python Window is truly baffling. The first time I ran this, it threw an error telling me that a float is not subscriptable; yet fields 17 and 18 are type Text. Then it defaulted to the disconnected workspace error described above, even after application restart.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2022 23:48:27 GMT</pubDate>
    <dc:creator>taylor</dc:creator>
    <dc:date>2022-10-10T23:48:27Z</dc:date>
    <item>
      <title>Python Window: The workspace is not connected</title>
      <link>https://community.esri.com/t5/python-questions/python-window-the-workspace-is-not-connected/m-p/1220527#M65815</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;As I am doing layout design with&amp;nbsp;&lt;STRONG&gt;arcpy.mp&lt;/STRONG&gt; in AGP 3.0, I'm experiencing the misfortune of having to use the Python Window instead of a reliable IDE like PyCharm. The latest problem: when I need to create a new layout and pull data from another file geodatabase, setting the workspace seems to have no effect, and using &lt;STRONG&gt;arcpy.da.SearchCursor()&lt;/STRONG&gt; consistently throws a &lt;EM&gt;RunTimeError: The workspace is not connected.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;circ = 'AOI'
dlDate = '10102022'

arcpy.env.workspace = fr"D:\myPath\{circ}_{dlDate}.gdb"
cGDB = arcpy.env.workspace
arcpy.env.overwriteOutput = True

print(cGDB)

MBfcs = arcpy.ListFeatureClasses()
MBtbs = arcpy.ListTables()
MBSurtb = MBtbs[0]

surFields = [f.name for f in arcpy.ListFields(MBSurtb)]
print(surFields)

with arcpy.da.SearchCursor(MBSurtb, surFields) as tableParser:
    for row in tableParser:
        fctyID = row[1]
        totSTR = row[3]
        subStr = row[4]
        subAdd = row[8]
        nonStr = row[6]
        wTxStr = row[10]
        totSpn = row[11]
        circMi = row[12]
        condMi = row[14]
        nCrcMi = row[15]
        nonSpn = row[16]
        datMin = row[17][4:]
        datMax = row[18][4:]
        fyrMin = row[17][:4]
        fyrMax = row[18][:4]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results:&lt;BR /&gt;D:\myPath\AOI_10102022.gdb&lt;BR /&gt;['OBJECTID', 'field1', 'field2', 'field3', 'field4', 'field5', 'field6', 'field7', 'field8', 'field9', 'field10', 'field11', 'field12', 'field13', 'field14', 'field15', 'field16', 'field17', 'field18']&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 26, in &amp;lt;module&amp;gt;&lt;BR /&gt;RuntimeError: The workspace is not connected.&lt;BR /&gt;&lt;BR /&gt;I've tried compacting the geodatabase as a first step to remove any locks, removing my &lt;STRONG&gt;with&lt;/STRONG&gt; statement for the search cursor, everything. It's seems like I can't redeclare variables? What could be happening here?&lt;BR /&gt;&lt;BR /&gt;The behavior of the Python Window is truly baffling. The first time I ran this, it threw an error telling me that a float is not subscriptable; yet fields 17 and 18 are type Text. Then it defaulted to the disconnected workspace error described above, even after application restart.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 23:48:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-window-the-workspace-is-not-connected/m-p/1220527#M65815</guid>
      <dc:creator>taylor</dc:creator>
      <dc:date>2022-10-10T23:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Python Window: The workspace is not connected</title>
      <link>https://community.esri.com/t5/python-questions/python-window-the-workspace-is-not-connected/m-p/1220533#M65816</link>
      <description>&lt;P&gt;try a notebook, you can vary environment settings&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/pro-notebooks.htm" target="_blank"&gt;Notebooks in ArcGIS Pro—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 00:22:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-window-the-workspace-is-not-connected/m-p/1220533#M65816</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-10-11T00:22:45Z</dc:date>
    </item>
  </channel>
</rss>

