<?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 AttributeError: 'str' object has no attribute 'workspace' in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626913#M48836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I type my simple testscript in the Python window in ArcGIS it runs fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try to debug the same script in PythonWin it can not find the workspace property of the arcpy.env object, it sees the env object as a string. Al the methods from a string object pop up in intellisense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
from arcpy import env
import os

# Set the workspace for the ListFeatureClass function
#
env.workspace = "c:/data"

# Use the ListFeatureClasses function to return a list of 
#&amp;nbsp; all shapefiles.
#
fcList = arcpy.ListFeatureClasses()

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Mar 2012 11:59:42 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2012-03-06T11:59:42Z</dc:date>
    <item>
      <title>AttributeError: 'str' object has no attribute 'workspace'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626913#M48836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I type my simple testscript in the Python window in ArcGIS it runs fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try to debug the same script in PythonWin it can not find the workspace property of the arcpy.env object, it sees the env object as a string. Al the methods from a string object pop up in intellisense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
from arcpy import env
import os

# Set the workspace for the ListFeatureClass function
#
env.workspace = "c:/data"

# Use the ListFeatureClasses function to return a list of 
#&amp;nbsp; all shapefiles.
#
fcList = arcpy.ListFeatureClasses()

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2012 11:59:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626913#M48836</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-03-06T11:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'str' object has no attribute 'workspace'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626914#M48837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is odd, it runs fine from IDLE.&amp;nbsp; Have you tried?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.workspace = "c:/data"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:43:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626914#M48837</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-12T02:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'str' object has no attribute 'workspace'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626915#M48838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've found similar problems with PythonWin when running a script. Someone on the forums (sorry, forget who) posted that you first have to do an import arcpy in the Idle window before it's available in the script window. That's new to me, but it appears to work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2012 16:37:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626915#M48838</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2012-03-08T16:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'str' object has no attribute 'workspace'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626916#M48839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is nuts!&amp;nbsp; I was having the same issue but importing the module in IDLE then running the script in PythonWin worked.&amp;nbsp; This has to be a bug.&amp;nbsp; The help files for version 9.3 included PythonWin instructions, but with issues like this how could anyone promote PythonWin?&amp;nbsp; Thank you Greg!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2012 21:30:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626916#M48839</guid>
      <dc:creator>GuyDuke</dc:creator>
      <dc:date>2012-03-14T21:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'str' object has no attribute 'workspace'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626917#M48840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is what you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://code.google.com/p/pyscripter/"&gt;http://code.google.com/p/pyscripter/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ten thumbs down for PythonWin. At least in relation to arcpy.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2012 21:55:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626917#M48840</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-03-14T21:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'str' object has no attribute 'workspace'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626918#M48841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I will never use PythonWin again...Thank you Mathew!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 22:17:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-str-object-has-no-attribute/m-p/626918#M48841</guid>
      <dc:creator>GuyDuke</dc:creator>
      <dc:date>2012-03-15T22:17:49Z</dc:date>
    </item>
  </channel>
</rss>

