<?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 Re: Arcpy and Geoprocessing Tool Warnings in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75916#M6173</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, it's worth noting that if a feature class is inside a feature dataset, the projection cannot be redefined -- it would have to be reprojected and with the destination set as a new feature dataset (which also has to be created beforehand, of course).&amp;nbsp; That's a fair amount of code that I won't post here, but I did change the recursiveDatasets function to put any feature classes residing inside feature datasets in their own list:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def recursiveDatasets(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Function iterates through a workspace and its subfolders using arcpy.da.walk and returns a tuple
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; containing two lists containing: 1) paths for all feature classes contained in feature datasets inside
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geodatabases and 2) filepaths for feature classes not inside feature datasets.&amp;nbsp; Parameter: target workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; """
&amp;nbsp;&amp;nbsp;&amp;nbsp; describeDatasets = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureDatasetFeatureClasses = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for dirpath, path, filenames in arcpy.da.Walk(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(os.path.join(dirpath, filename)) # create a desctription object for each feature
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if hasattr(desc, 'path'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; descPth = arcpy.Describe(desc.path)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if hasattr(descPth, 'dataType'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if a feature class is part of a feature dataset, which cannot be reprojected,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add it to featureDatasetFeatureClasses list:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if descPth.dataType == 'FeatureDataset':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureDatasetFeatureClasses.append(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if not part of feature dataset, add it to filesList
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList.append(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp; return featureDatasetFeatureClasses, filesList&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:56:28 GMT</pubDate>
    <dc:creator>TrilliumLevine1</dc:creator>
    <dc:date>2021-12-10T22:56:28Z</dc:date>
    <item>
      <title>Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75907#M6164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a script which I'm trying to implement to re-define the projections of all datasets in a directory and its subdirectories.&amp;nbsp; I'm using the define projection tool from data management to do this.&amp;nbsp; Unfortunately, when I run the script, I'm getting an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/141713_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to define the projection in one of these datasets directly through ArcToolbox, I get the following warning:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/141712_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My guess is that I need to write some error handling into the script in order to dismiss this warning, but I can't find anything anywhere that explains clearly how I might implement this.&amp;nbsp; Anyone have any ideas?&amp;nbsp; Feedback is greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
import arcpy
from arcpy import env

arcpy.env.overwriteOutput = True
workspace = r"C:\Scripts\Redefine Projection"
newProjection = arcpy.SpatialReference(25832) # wkid for 'ETRS_1989_UTM_Zone_32N'

def recursiveProjections(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Function iterates through a workspace and its subfolders using arcpy.da.walk and returns
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a tuple containing two lists: 1) list of spatial reference objects of all geographic datasets (including those inside
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geodatabases) and 2) a list of filepaths for the geographic datasets.&amp;nbsp; Parameter: target workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; """
&amp;nbsp;&amp;nbsp;&amp;nbsp; describeDatasets = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for dirpath, path, filenames in arcpy.da.Walk(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; describeDatasets.append(desc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for path, path_names, data_names in arcpy.da.Walk(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for data_name in data_names:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList.append(os.path.join(path, data_name))
&amp;nbsp;&amp;nbsp;&amp;nbsp; return describeDatasets, filesList

def defineProjection(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Function redefines the existing projection for datasets in a workspace.&amp;nbsp; A log file is created listing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the paths of all redefined datasets.&amp;nbsp; Parameter: workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; """
&amp;nbsp;&amp;nbsp;&amp;nbsp; # unpack tuple returned by def recursiveProjections into two lists
&amp;nbsp;&amp;nbsp;&amp;nbsp; descriptions, filenames = recursiveProjections(workspace)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # iterate through features and redefine their projections correctly
&amp;nbsp;&amp;nbsp;&amp;nbsp; for feature in descriptions:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DefineProjection_management(feature, newProjection)

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; defineProjection(workspace)

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:56:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75907#M6164</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2021-12-10T22:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75908#M6165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you using a toolbox when you haven't defined any parameters to get values from the tools?&amp;nbsp; Your script appears to be a standalone script, which you can edit and run.&amp;nbsp; If you want to use a toolbox, then you have to get the parameters as variables, then define those parameters in the toolbox.&amp;nbsp; And based on your script, I don't think you want to get a featureclass as the first input variable, you want a workspace (ie gdb or folder).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you show the link between your script and the parameters you defined in the toolbox?&lt;/P&gt;&lt;P&gt;Where are you in this process?&amp;nbsp; &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/creating-tools/a-quick-tour-of-creating-tools-in-python.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/creating-tools/a-quick-tour-of-creating-tools-in-python.htm"&gt;A quick tour of creating tools with Python—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 14:54:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75908#M6165</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-11-11T14:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75909#M6166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might want to look at the Define Projection Help, they give a good example on the standalone script for using try/except blocks to handle error messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#//001700000077000000" title="http://resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#//001700000077000000"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also just as always a reminder that Define Projection is only to be used when a a file has an unknown coordinate system or is currently using an incorrect coordinate system. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"The most common use for this tool is to assign a known coordinate system to a dataset with an unknown coordinate system (that is, the coordinate system is "Unknown" in the dataset properties). Another use is to assign the correct &lt;/P&gt;&lt;P&gt;coordinate system for a dataset that has an incorrect coordinate system defined (for example, the coordinates are in UTM meters but the coordinate system is defined as geographic)."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also may I recommend that you do not put spaces in your filepaths anywhere, they have a bad habit of messing up some geoprocessing tools.&amp;nbsp; You may want to rename your folder to remove the space. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 14:57:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75909#M6166</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-11-11T14:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75910#M6167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan, thanks for your response.&amp;nbsp; I'm just running a standalone script, I just ran the tool to demonstrate the error that I assume is being encountered when the script is run.&amp;nbsp; I'm not trying to develop a toolbox, just a script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 14:58:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75910#M6167</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2015-11-11T14:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75911#M6168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ian, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the response.&amp;nbsp; I'm doing this because the custom&amp;nbsp; projection on these datasets needs to be renamed to an identical known projection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I can tell, the example on the Define Projection help page just prints the error I get, but I need something that will tell it to acknowledge the error but run anyway.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 15:05:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75911#M6168</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2015-11-11T15:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75912#M6169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The warning should pass on its own (Warning 000132.....), but the runtime error is the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at your code, you are running the Define Projection against the description object you made, shouldn't it be running it with the file names?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 15:11:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75912#M6169</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-11-11T15:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75913#M6170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah -- now that makes more sense.&amp;nbsp; Thanks for pointing that out...so I guess I just need to pass the tool the file path string, yes?&amp;nbsp; For some reason I thought I had to pass it the description.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 15:16:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75913#M6170</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2015-11-11T15:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75914#M6171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Working better now or still getting errors?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 15:34:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75914#M6171</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-11-11T15:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75915#M6172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ian, sorry, I'm on European time.&amp;nbsp; Yup, looks good, thanks again...new code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
import arcpy
from arcpy import env

arcpy.env.overwriteOutput = True
workspace = r"C:\Scripts\Redefine Projection"
newProjection = arcpy.SpatialReference(25832) # wkid for 'ETRS_1989_UTM_Zone_32N'

def recursiveDatasets(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Function iterates through a workspace and its subfolders using arcpy.da.walk and returns
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a list of unicode filepaths for every geogrpahic dataset in wht workspace.&amp;nbsp; Parameter: target workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; """
&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for path, path_names, data_names in arcpy.da.Walk(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for data_name in data_names:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList.append(os.path.join(path, data_name))
&amp;nbsp;&amp;nbsp;&amp;nbsp; return filesList

def defineProjection(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Function redefines the existing projection for datasets in a workspace.&amp;nbsp; A log file is created listing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the paths of all redefined datasets.&amp;nbsp; Parameter: workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; """
&amp;nbsp;&amp;nbsp;&amp;nbsp; datasetPaths = recursiveDatasets(workspace)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # iterate through features and redefine their projections correctly
&amp;nbsp;&amp;nbsp;&amp;nbsp; for feature in datasetPaths:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DefineProjection_management(feature, newProjection)
##&amp;nbsp;&amp;nbsp;&amp;nbsp; # logging
##&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print filename


def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; defineProjection(workspace)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:56:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75915#M6172</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2021-12-10T22:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy and Geoprocessing Tool Warnings</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75916#M6173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, it's worth noting that if a feature class is inside a feature dataset, the projection cannot be redefined -- it would have to be reprojected and with the destination set as a new feature dataset (which also has to be created beforehand, of course).&amp;nbsp; That's a fair amount of code that I won't post here, but I did change the recursiveDatasets function to put any feature classes residing inside feature datasets in their own list:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def recursiveDatasets(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Function iterates through a workspace and its subfolders using arcpy.da.walk and returns a tuple
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; containing two lists containing: 1) paths for all feature classes contained in feature datasets inside
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geodatabases and 2) filepaths for feature classes not inside feature datasets.&amp;nbsp; Parameter: target workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; """
&amp;nbsp;&amp;nbsp;&amp;nbsp; describeDatasets = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureDatasetFeatureClasses = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for dirpath, path, filenames in arcpy.da.Walk(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(os.path.join(dirpath, filename)) # create a desctription object for each feature
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if hasattr(desc, 'path'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; descPth = arcpy.Describe(desc.path)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if hasattr(descPth, 'dataType'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if a feature class is part of a feature dataset, which cannot be reprojected,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add it to featureDatasetFeatureClasses list:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if descPth.dataType == 'FeatureDataset':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureDatasetFeatureClasses.append(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if not part of feature dataset, add it to filesList
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filesList.append(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp; return featureDatasetFeatureClasses, filesList&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:56:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-and-geoprocessing-tool-warnings/m-p/75916#M6173</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2021-12-10T22:56:28Z</dc:date>
    </item>
  </channel>
</rss>

