<?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: Runscript Error - line 312??? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608986#M47525</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you checked to make sure the files and folders exist, have valid names etc?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Apr 2012 20:48:19 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2012-04-30T20:48:19Z</dc:date>
    <item>
      <title>Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608985#M47524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anyone know why I get this error in my traceback: The first and last errors - I cannot find any documentation on. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas would be greatly appreciated. This is a very simple script to rename a batch of raster files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "G:\Documentation\Python_Scripts\batchCopyRaster_COL.py", line 32, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRaster_management(input,output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 6835, in CopyRaster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 20:42:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608985#M47524</guid>
      <dc:creator>MikeBly</dc:creator>
      <dc:date>2012-04-30T20:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608986#M47525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you checked to make sure the files and folders exist, have valid names etc?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 20:48:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608986#M47525</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-04-30T20:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608987#M47526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry to say it, but I'd guess the parameters are not valid (either "input" or "output"), but you'd have to post the code for anyone to figure it out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 20:51:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608987#M47526</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2012-04-30T20:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608988#M47527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have you checked to make sure the files and folders exist, have valid names etc?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All the files and folders look correct, and the script references the proper locations, ???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 15:36:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608988#M47527</guid>
      <dc:creator>MikeBly</dc:creator>
      <dc:date>2012-05-02T15:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608989#M47528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Sorry to say it, but I'd guess the parameters are not valid (either "input" or "output"), but you'd have to post the code for anyone to figure it out.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the super simple code - I must be missing something obvious - be kind I am a newbie to scripting...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Set working directory&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = "G:\Imagery\Orthos_2009\Photos\TIFF"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Define Input and Output folder&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;InFolder = "G:\Imagery\Orthos_2009\Photos\TIFF" &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OutFolder = "G:\Imagery\Orthos_2009\Photos\TIFF_Renamed"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Create List of Rasters in Folder&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rasterList = arcpy.ListRasters()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Loop Through Folder renaming rasters and save in new folder&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for raster in rasterList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; print("Beginning Copy of " + raster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; input = InFolder + "/" + raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; output = OutFolder + "/nn" + raster &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#Copy Rasters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.CopyRaster_management(input,output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; print(" Copy of " + raster + " complete." + "\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; rasterList.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;del arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts here, thanks for the help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 15:40:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608989#M47528</guid>
      <dc:creator>MikeBly</dc:creator>
      <dc:date>2012-05-02T15:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608990#M47529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your paths are incorrect. Valid path formats are as follows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.workspace = r"G:\Imagery\Orthos_2009\Photos\TIFF"
arcpy.env.workspace = "G:\\Imagery\\Orthos_2009\\Photos\\TIFF"
arcpy.env.workspace = "G:/Imagery/Orthos_200/Photos/TIFF"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The proper way to combine a path and file name are as follows. Both of these require importing the os module&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
input = os.path.join(InFolder,raster) # Much preferred
input = InFolder + os.sep + raster
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:03:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608990#M47529</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-12T02:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608991#M47530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have you checked to make sure the files and folders exist, have valid names etc?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for this - got me thinking about supported file types with the Copy Raster function - I was using ECW file which are not supported. Switched over to TIFFs and the code works - kinda - just need to figure the looping. Creates first file properly and then quits - this is due to my rasterList.next() which is a 9.3 function - need to figure the 10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 18:10:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608991#M47530</guid>
      <dc:creator>MikeBly</dc:creator>
      <dc:date>2012-05-02T18:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Runscript Error - line 312???</title>
      <link>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608992#M47531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I managed to get the code to start working, let it run through the renaming of a few of the files - the new problem is the quality of the new raster file. There are two attachments for those who may be curious.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found that the pixel value remains - however the stretched value is changed upon running the script. I have found a work around outside of python, but if there any ideas as to why the stretched value would get modified, be great to hear.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MIke&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 19:18:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/runscript-error-line-312/m-p/608992#M47531</guid>
      <dc:creator>MikeBly</dc:creator>
      <dc:date>2012-05-02T19:18:09Z</dc:date>
    </item>
  </channel>
</rss>

