<?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: Python Script Doesn't Work When Scheduled But Works in Pro - Path Name in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-script-doesn-t-work-when-scheduled-but/m-p/1302322#M68019</link>
    <description>&lt;P&gt;Haven't written much code lately, but i remember having issues like this when i exported a script from GEO&lt;/P&gt;&lt;P&gt;P tools.&amp;nbsp; Maybe outside of the Pro environment the script doesn't know your parameter locations..&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2023 02:01:51 GMT</pubDate>
    <dc:creator>PaulTHEDUDELang</dc:creator>
    <dc:date>2023-06-23T02:01:51Z</dc:date>
    <item>
      <title>Python Script Doesn't Work When Scheduled But Works in Pro - Path Name</title>
      <link>https://community.esri.com/t5/python-questions/python-script-doesn-t-work-when-scheduled-but/m-p/1302303#M68018</link>
      <description>&lt;P&gt;Hi, I'm having a problem where I run a custom Python script.&amp;nbsp; It works when I run it in ArcGIS Pro, but it fails when I run it as a scheduled geoprocessing tool.&lt;/P&gt;&lt;P&gt;The relevant lines of code:&lt;/P&gt;&lt;P&gt;# Local variables:&lt;BR /&gt;# Input and Output Directories&lt;BR /&gt;Project = sys.argv[1]&lt;BR /&gt;outPath = sys.argv[2]&lt;BR /&gt;sourceMap = sys.argv[3]&lt;BR /&gt;FGDB = sys.argv[4]&lt;BR /&gt;Shapefile = sys.argv[5]&lt;BR /&gt;Coord = sys.argv[6]&lt;/P&gt;&lt;P&gt;# Create name for backup GDB&lt;BR /&gt;startName = sourceMap&lt;BR /&gt;mapName = startName.replace(" ", "_")&lt;BR /&gt;today = datetime.date.today()&lt;BR /&gt;date = today.strftime("%Y%m%d")&lt;BR /&gt;name = mapName + "_Backup_" + str(date) + ".gdb"&lt;/P&gt;&lt;P&gt;# Create the GDB for the output feature classes&lt;BR /&gt;arcpy.CreateFileGDB_management(outPath, name)&lt;/P&gt;&lt;P&gt;This last line above is line 53.&lt;/P&gt;&lt;P&gt;The error message I get is:&lt;/P&gt;&lt;P&gt;File "#####", line 53, in &amp;lt;module&amp;gt;&lt;BR /&gt;arcpy.CreateFileGDB_management(outPath, name)&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 24891, in CreateFileGDB&lt;BR /&gt;raise e&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 24888, in CreateFileGDB&lt;BR /&gt;retval = convertArcObjectToPythonObject(gp.CreateFileGDB_management(*gp_fixargs((out_folder_path, out_name, out_version), True)))&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 000816: The tool is not valid.&lt;BR /&gt;Failed to execute (CreateFileGDB).&lt;/P&gt;&lt;P&gt;When I run it in ArcGIS Pro as a script tool, it runs no problem.&amp;nbsp; Here are my tool parameters:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DianneGrayGV_1-1687478199705.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74000i21EF28DCEDF238A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DianneGrayGV_1-1687478199705.png" alt="DianneGrayGV_1-1687478199705.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What is the difference between the script succeeding in creating an out path name when running in Pro, versus running as a scheduled tool?&amp;nbsp; I've tried choosing the output location in different places, including on the C drive, and making sure there are no hyphens in the path, but that doesn't seem to make a difference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone please point this out to me!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 00:03:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-doesn-t-work-when-scheduled-but/m-p/1302303#M68018</guid>
      <dc:creator>DianneGrayGV</dc:creator>
      <dc:date>2023-06-23T00:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Doesn't Work When Scheduled But Works in Pro - Path Name</title>
      <link>https://community.esri.com/t5/python-questions/python-script-doesn-t-work-when-scheduled-but/m-p/1302322#M68019</link>
      <description>&lt;P&gt;Haven't written much code lately, but i remember having issues like this when i exported a script from GEO&lt;/P&gt;&lt;P&gt;P tools.&amp;nbsp; Maybe outside of the Pro environment the script doesn't know your parameter locations..&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 02:01:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-doesn-t-work-when-scheduled-but/m-p/1302322#M68019</guid>
      <dc:creator>PaulTHEDUDELang</dc:creator>
      <dc:date>2023-06-23T02:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Doesn't Work When Scheduled But Works in Pro - Path Name</title>
      <link>https://community.esri.com/t5/python-questions/python-script-doesn-t-work-when-scheduled-but/m-p/1302358#M68020</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/basics/schedule-geoprocessing-tools.htm" target="_blank"&gt;Schedule geoprocessing tools—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/tool-errors-and-warnings/001001-010000/tool-errors-and-warnings-00801-00825-000816.htm" target="_blank"&gt;000816: The tool is not valid.—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The latter lists the possible reason for the tool failure and methods to correct it&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 06:46:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-doesn-t-work-when-scheduled-but/m-p/1302358#M68020</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-06-23T06:46:19Z</dc:date>
    </item>
  </channel>
</rss>

