<?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: Something simple that I can't seem to troubleshoot? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096911#M62324</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Here is the error message that I keep getting when it runs.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Failed script Import Test...
Traceback (most recent call last):
  File "*:\CAD Exporting Test\Default.tbx#ImportTest_Default.py", line 207, in &amp;lt;module&amp;gt;
  File "*:\CAD Exporting Test\Default.tbx#ImportTest_Default.py", line 183, in ScriptTool
  File "*:\''\''\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ntpath.py", line 76, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not Result
Failed to execute (ImportTest).&lt;/LI-CODE&gt;&lt;P&gt;Not sure what this error refers to but I can't seem to bypass it for some reason. I am thinking that the issue is either a syntax issue or an output error.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Sep 2021 19:28:45 GMT</pubDate>
    <dc:creator>RPGIS</dc:creator>
    <dc:date>2021-09-09T19:28:45Z</dc:date>
    <item>
      <title>Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096744#M62304</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am currently working on a custom python tool that works until a certain point. The issue that I am having, and it is probably really simple but I can't seem to trouble shoot, is specifying the feature class using os.path.join method (unless I configured this wrong but running a random test proves otherwise).&lt;/P&gt;&lt;P&gt;The input workspace is set by a created gdb derived from one of the user inputs. Everything works until this point and I am now at a standstill. Any help on this would be greatly appreciated.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

Project_GDB = 'input random gdb'

SubBoundaryFC_Name = 'SubdivisionBoundary'
SubdivisionFC = os.path.join(Project_GDB, SubBoundaryFC_Name)
SubBoundary = arcpy.management.FeatureToPolygon(FCs_forSubdivisionBoundary, SubBoundaryFC_Name)
arcpy.AddMessage('{} has been created.'.format(SubBoundary))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Sep 2021 14:02:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096744#M62304</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-09-09T14:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096750#M62305</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/22623"&gt;@RPGIS&lt;/a&gt;&amp;nbsp;you haven't declared this variable:&lt;/P&gt;&lt;PRE&gt;FCs_forSubdivisionBoundary&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 14:08:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096750#M62305</guid>
      <dc:creator>David_Brooks</dc:creator>
      <dc:date>2021-09-09T14:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096756#M62306</link>
      <description>&lt;P&gt;It can be tricky trying to troubleshoot script tools but there are some ways you can get error messages.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

Project_GDB = 'input random gdb'
try:
    SubBoundaryFC_Name = 'SubdivisionBoundary'
    SubdivisionFC = os.path.join(Project_GDB, SubBoundaryFC_Name)
    # As Brooks mentioned, should SubdivisionFC be FCs_forSubdivisionBoundary below?
    SubBoundary = arcpy.management.FeatureToPolygon(FCs_forSubdivisionBoundary, SubBoundaryFC_Name)
    arcpy.AddMessage('{} has been created.'.format(SubBoundary))
except:
    arcpy.AddError(arcpy.GetMessages(2))&lt;/LI-CODE&gt;&lt;P&gt;or if you want to test the script in an IDE as a standalone/script tool script and use env.workspace:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
Project_GDB = arcpy.GetParametersAsText(0) # value assigned when ran as script tool
if Project_GDB == '' or not Project_GDB:
    Project_GDB = 'input random gdb' # default value for standalone

SubBoundaryFC_Name = arcpy.GetParametersAsText(1)
if SubBoundaryFC_Name == '' or not SubBoundaryFC_Name:
    SubBoundaryFC_Name = 'SubdivisionBoundary'

try:
    arcpy.env.workspace = Project_GDB
    # if the target fc's are in the project_gdb, you should be able to reference them by name and not have to use os.path.join if you set your env.workspace
    SubBoundary = arcpy.management.FeatureToPolygon("FCs_forSubdivisionBoundary", SubBoundaryFC_Name)
    arcpy.AddMessage('{} has been created.'.format(SubBoundary))
except:
    arcpy.AddError(arcpy.GetMessages(2))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 14:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096756#M62306</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-09-09T14:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096777#M62307</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;has some good suggestions for error handling. I want to point out that the &lt;FONT face="courier new,courier"&gt;except&lt;/FONT&gt; like that will catch all exceptions but will only attempt to output specifically arcpy geoprocessing errors. A more well rounded solution would be a specific &lt;FONT face="courier new,courier"&gt;except&lt;/FONT&gt; and a general &lt;FONT face="courier new,courier"&gt;except&lt;/FONT&gt; for everything else.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

Project_GDB = 'input random gdb'
try:
    SubBoundaryFC_Name = 'SubdivisionBoundary'
    SubdivisionFC = os.path.join(Project_GDB, SubBoundaryFC_Name)
    # As Brooks mentioned, should SubdivisionFC be FCs_forSubdivisionBoundary below?
    SubBoundary = arcpy.management.FeatureToPolygon(FCs_forSubdivisionBoundary, SubBoundaryFC_Name)
    arcpy.AddMessage('{} has been created.'.format(SubBoundary))
except arcpy.ExecuteError:
    arcpy.AddError(arcpy.GetMessages(2))
except Exception as e:
    arcpy.AddError(e)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/error-handling-with-python.htm" target="_blank" rel="noopener"&gt;Error handling with Python—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 14:53:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096777#M62307</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-09-09T14:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096802#M62308</link>
      <description>&lt;P&gt;I would suggest adding print statements for variables to ensure that they are being populated as expected.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 15:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096802#M62308</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-09-09T15:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096853#M62317</link>
      <description>&lt;P&gt;I accidently left out of the snippet for this little piece here by mistake.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;FCs_forSubdivisionBoundary = []&lt;/LI-CODE&gt;&lt;P&gt;It is derived from using walk to append each feature class in the database based on matching names.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 17:17:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096853#M62317</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-09-09T17:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096902#M62323</link>
      <description>&lt;P&gt;Are you getting a particular error message? If so, please paste the entire traceback if you can. Is everything in&amp;nbsp;FCs_forSubdivisionBoundary a line or polygon feature class? Also, try using&amp;nbsp;SubdivisionFC as the&amp;nbsp;out_feature_class&amp;nbsp;for FeatureToPolygon() instead of&amp;nbsp;SubBoundaryFC_Name (because no workspace is specified).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 19:09:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096902#M62323</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-09-09T19:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096911#M62324</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Here is the error message that I keep getting when it runs.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Failed script Import Test...
Traceback (most recent call last):
  File "*:\CAD Exporting Test\Default.tbx#ImportTest_Default.py", line 207, in &amp;lt;module&amp;gt;
  File "*:\CAD Exporting Test\Default.tbx#ImportTest_Default.py", line 183, in ScriptTool
  File "*:\''\''\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ntpath.py", line 76, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not Result
Failed to execute (ImportTest).&lt;/LI-CODE&gt;&lt;P&gt;Not sure what this error refers to but I can't seem to bypass it for some reason. I am thinking that the issue is either a syntax issue or an output error.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 19:28:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096911#M62324</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-09-09T19:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096932#M62326</link>
      <description>&lt;P&gt;That error means you're taking a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/result.htm" target="_self"&gt;Result object&lt;/A&gt; (output from a geoprocessing tool) and inputting it directly into something else without unpacking it.&lt;/P&gt;&lt;P&gt;I can't say exactly where it's happening since we don't have the whole script but look on line 183. Something there is getting a result object when it should be getting something more specific (like a string path to a feature class).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 20:11:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1096932#M62326</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-09-09T20:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Something simple that I can't seem to troubleshoot?</title>
      <link>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1097148#M62333</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;So I figured out the issue with part of the script that was giving me issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Check to see if the following project already exists. If project exists, overwrite the existing project.
        Project_GDB = ''
        for root, directory, files in os.walk(folder_location):
                GDB = os.path.split(root)[-1]

                if GDB == ProjectGDB:
                        Project_GDB  = root
                else:
                        Project_GDB = arcpy.management.CreateFileGDB(folder_location, Project)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Further in the script I converted the output to a string and then utilized the os.path.join which worked as intended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;SubBoundaryFC_Name = 'SubdivisionBoundary'
SubdivisionFC = os.path.join(str(Project_GDB), SubBoundaryFC_Name)
SubBoundary = arcpy.management.FeatureToPolygon(FCs_forSubdivisionBoundary, SubdivisionFC)
arcpy.AddMessage('{} has been created.'.format(SubBoundaryFC_Name))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this simple solution was really all I needed. Here is the message result that it generated.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;SubdivisionBoundary has been created.&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Sep 2021 11:55:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/something-simple-that-i-can-t-seem-to-troubleshoot/m-p/1097148#M62333</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-09-10T11:55:50Z</dc:date>
    </item>
  </channel>
</rss>

