<?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: For Loop: Convert Point to Raster and Keep Base File Name In Output in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361101#M28469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not 100% sure which piece of your code is giving you the error. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I use a similar code and was able to preform the process on some of my own data. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't include the output coordinate so that would have to be added back in. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Set Variables
inWS = r"C:\My_Stuff\ConvertPTtoRaster\SHP"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # In workspace
outWS = r"C:\My_Stuff\ConvertPTtoRaster\Output" # Out workspace
arcpy.env.workspace = inWS
arcpy.env.overwriteOutput = 1
arcpy.env.extent = "2470500 7661500 2477000 7666800"

arcpy.env.cellSize = 25

ptFeatures = list()
ptFeatures = arcpy.ListFeatureClasses("","Point") #Only use points features

for fc in ptFeatures:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fName = arcpy.Describe(fc).basename 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.PointToRaster_conversion(fc,"Z",outWS + "\\" + fName,"MAXIMUM","",25)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With your code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;inWS = "E:\\MichaelBrady\\Graduate_work\\MAIN\\Classes\\spring2012\\ind_study\\nexrad\\data\\irene_nexrad\\nexrad_Irene_Working"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # In workspace
outWS = inWS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Out workspace
arcpy.env.workspace = inWS
arcpy.env.overwriteOutput = 1
arcpy.env.extent = "-236 -1476 661 -806"

arcpy.env.cellSize = 1

ptFeatures = list()
ptFeatures = arcpy.ListFeatureClasses("","Point") #Only use points features

for fc in ptFeatures:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fName = arcpy.Describe(fc).basename 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.PointToRaster_conversion(fc,"Globvalue",outWS + "\\" + fName,"MAXIMUM","NONE",1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it works!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:50:08 GMT</pubDate>
    <dc:creator>BenjaminGale</dc:creator>
    <dc:date>2021-12-11T16:50:08Z</dc:date>
    <item>
      <title>For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361095#M28463</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'm very new to Python. I'm attempting to convert multiple point shapefiles to GRIDs and retain the base file name of each input shapefile. When I run my script, Python crashes with no helpful error message. I've also noticed that when I try to run the script a second time after I've made edits, the data become inaccessible and I have to close all programs, and delete the folder containing my shapefiles before Python will work (up to where it crashes). I've been working on this for days and have made no progress. I'd really appreciate any pointers. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: I've successfully run the script when I convert one file and specify a string name. I believe the problem I'm having has to do with how I'm naming the output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
# Set local environment:
Path = "E:\\MichaelBrady\\Graduate_work\\MAIN\\Classes\\spring2012\\ind_study\\nexrad\\data\\irene_nexrad\\"
Working = Path + "nexrad_Irene_Working" 
arcpy.env.workspace = Working
arcpy.env.overwriteOutput = 1
# Set local variables:
NEXRAD2grid = arcpy.ListFeatureClasses()
HRAP_Projection = "PROJCS['HRAP_Projection',GEOGCS['HRAP_GCS',DATUM['D_HRAP',SPHEROID['HRAP_Sphere',6371200.0,0.0]],PRIMEM['&amp;lt;custom&amp;gt;',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Stereographic_North_Pole'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-105.0],PARAMETER['Standard_Parallel_1',60.0],UNIT['HRAP_Grid',4762.5]]"

arcpy.env.outputCoordinateSystem = HRAP_Projection
arcpy.env.extent = "-236 -1476 661 -806"
arcpy.env.cellSize = "1"


for fc in NEXRAD2grid:
&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = desc.name
&amp;nbsp;&amp;nbsp;&amp;nbsp; NEXRADgrids = filename[:-4]
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.PointToRaster_conversion(fc, "Globvalue", NEXRADgrids, "MAXIMUM", "NONE", "1") #execute point to raster
&amp;nbsp;&amp;nbsp;&amp;nbsp; print NEXRADgrids
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 22:46:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361095#M28463</guid>
      <dc:creator>MichaelBrady</dc:creator>
      <dc:date>2012-05-03T22:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361096#M28464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't know the exact issue with your script, but are you running this within ArcGIS or as a stand alone python script?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it's stand alone, my next question would be which python handler are you using?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I personally use IDLE, and when I've had trouble with it I use the debugger to step through each line to find where it's causing problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're unsure of using the debugger there's a plethora of info on it by searching for it.&amp;nbsp; It may not solve the exact problem, but at the very least, it should 100% confirm the exact point the script is failing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 00:44:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361096#M28464</guid>
      <dc:creator>StephenKruzik</dc:creator>
      <dc:date>2012-05-04T00:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361097#M28465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; When I run my script, Python crashes with no helpful error message. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suggest looking into the online help examples on exception handling -- these techniques can really help - for example, you can print which line the script failed on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000000q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Arc 10 Help: Error handling with Python&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's a try/except wrapped around your code that will do that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color:&amp;quot;#0000FF&amp;quot;;"&gt;import sys
import traceback
import arcpy
try:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local environment:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Path = "E:\\MichaelBrady\\Graduate_work\\MAIN\\Classes\\spring2012\\ind_study\\nexrad\\data\\irene_nexrad\\"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Working = Path + "nexrad_Irene_Working" 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Working
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local variables:
&amp;nbsp;&amp;nbsp;&amp;nbsp; NEXRAD2grid = arcpy.ListFeatureClasses()
&amp;nbsp;&amp;nbsp;&amp;nbsp; HRAP_Projection = "PROJCS['HRAP_Projection',GEOGCS['HRAP_GCS',DATUM['D_HRAP',SPHEROID['HRAP_Sphere',6371200.0,0.0]],PRIMEM['&amp;lt;custom&amp;gt;',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Stereographic_North_Pole'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-105.0],PARAMETER['Standard_Parallel_1',60.0],UNIT['HRAP_Grid',4762.5]]"

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.outputCoordinateSystem = HRAP_Projection
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.extent = "-236 -1476 661 -806"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.cellSize = "1"

&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in NEXRAD2grid:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = desc.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEXRADgrids = filename[:-4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.PointToRaster_conversion(fc, "Globvalue", NEXRADgrids, "MAXIMUM", "NONE", "1") #execute point to raster
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print NEXRADgrids
&lt;SPAN style="color:&amp;quot;#0000FF&amp;quot;;"&gt;except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # print python errors
&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; print tbinfo
&amp;nbsp;&amp;nbsp;&amp;nbsp; # print geprocessing errors messages (if any)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(2)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;PS Please &lt;A href="&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;a" target="_blank" rel="nofollow noopener noreferrer"&gt; tags&lt;/A&gt; when posting Python code.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:50:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361097#M28465</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T16:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361098#M28466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I don't know the exact issue with your script, but are you running this within ArcGIS or as a stand alone python script?&lt;BR /&gt;&lt;BR /&gt;If it's stand alone, my next question would be which python handler are you using?&lt;BR /&gt;&lt;BR /&gt;I personally use IDLE, and when I've had trouble with it I use the debugger to step through each line to find where it's causing problems.&lt;BR /&gt;&lt;BR /&gt;If you're unsure of using the debugger there's a plethora of info on it by searching for it.&amp;nbsp; It may not solve the exact problem, but at the very least, it should 100% confirm the exact point the script is failing.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the IDLE and am now trying to debug. I know the problem has to do with how I'm naming the output file, but I'm not sure what exactly the problem is. Will the debugger only help me identify where the problem is or also what the problem might be (I'm researching this now)? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 22:02:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361098#M28466</guid>
      <dc:creator>MichaelBrady</dc:creator>
      <dc:date>2012-05-04T22:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361099#M28467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; I suggest looking into the online help examples on exception handling -- these techniques can really help - for example, you can print which line the script failed on.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000000q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Arc 10 Help: Error handling with Python&lt;/A&gt; &lt;BR /&gt; &lt;BR /&gt;Here's a try/except wrapped around your code that will do that:&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color:&amp;quot;#0000FF&amp;quot;;"&gt;import sys
import traceback
import arcpy
try:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local environment:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Path = "E:\\MichaelBrady\\Graduate_work\\MAIN\\Classes\\spring2012\\ind_study\\nexrad\\data\\irene_nexrad\\"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Working = Path + "nexrad_Irene_Working" 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = Working
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set local variables:
&amp;nbsp;&amp;nbsp;&amp;nbsp; NEXRAD2grid = arcpy.ListFeatureClasses()
&amp;nbsp;&amp;nbsp;&amp;nbsp; HRAP_Projection = "PROJCS['HRAP_Projection',GEOGCS['HRAP_GCS',DATUM['D_HRAP',SPHEROID['HRAP_Sphere',6371200.0,0.0]],PRIMEM['&amp;lt;custom&amp;gt;',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Stereographic_North_Pole'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-105.0],PARAMETER['Standard_Parallel_1',60.0],UNIT['HRAP_Grid',4762.5]]"

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.outputCoordinateSystem = HRAP_Projection
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.extent = "-236 -1476 661 -806"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.cellSize = "1"

&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in NEXRAD2grid:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = desc.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEXRADgrids = filename[:-4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.PointToRaster_conversion(fc, "Globvalue", NEXRADgrids, "MAXIMUM", "NONE", "1") #execute point to raster
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print NEXRADgrids
&lt;SPAN style="color:&amp;quot;#0000FF&amp;quot;;"&gt;except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # print python errors
&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; print tbinfo
&amp;nbsp;&amp;nbsp;&amp;nbsp; # print geprocessing errors messages (if any)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(2)&lt;/SPAN&gt;&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;PS Please &lt;A href="&amp;quot;http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-codel" target="_blank" rel="nofollow noopener noreferrer"&gt; tags&lt;/A&gt; when posting Python code.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I should have said that I get no error message at all. Python crashes (i.e. "Python has topped working, checking for solution, etc.". When I entered your code, Python crashed. I'm continuing to research the problem and am open to other suggestions for trouble shooting. I am 99% where the problem is - the method I'm using to name my output fcs (i.e. "NEXRADgrids"), but I don't know what exactly what the problem is. When it crashes, I get 1 empty grid file with the naming I want. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the future, I will use code tags, though the link you provided did not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:50:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361099#M28467</guid>
      <dc:creator>MichaelBrady</dc:creator>
      <dc:date>2021-12-11T16:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361100#M28468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Will the debugger only help me identify where the problem is or also what the problem might be? &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe. The debugger can be very helpful because you can step through the code line at a time and easily examine values of variables while the code is executing. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For me, using the debugger is usually overkill if I have wrapped my code as above, as then I get much more complete error messaging that usually makes the problem obvious. I usually just use print statements to help me check values of variables, but that's mostly because I haven't become very skilled using debugging software.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;When I entered your code, Python crashed.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To learn how to use try/except blocks, I'd start with a simpler test than entering the whole kaboodle above, or the examples in the online help I pointed you too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the thread, [thread=48475]here's that code tag link, repaired.[/thread]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 22:23:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361100#M28468</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-05-04T22:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361101#M28469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not 100% sure which piece of your code is giving you the error. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I use a similar code and was able to preform the process on some of my own data. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't include the output coordinate so that would have to be added back in. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Set Variables
inWS = r"C:\My_Stuff\ConvertPTtoRaster\SHP"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # In workspace
outWS = r"C:\My_Stuff\ConvertPTtoRaster\Output" # Out workspace
arcpy.env.workspace = inWS
arcpy.env.overwriteOutput = 1
arcpy.env.extent = "2470500 7661500 2477000 7666800"

arcpy.env.cellSize = 25

ptFeatures = list()
ptFeatures = arcpy.ListFeatureClasses("","Point") #Only use points features

for fc in ptFeatures:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fName = arcpy.Describe(fc).basename 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.PointToRaster_conversion(fc,"Z",outWS + "\\" + fName,"MAXIMUM","",25)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With your code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;inWS = "E:\\MichaelBrady\\Graduate_work\\MAIN\\Classes\\spring2012\\ind_study\\nexrad\\data\\irene_nexrad\\nexrad_Irene_Working"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # In workspace
outWS = inWS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Out workspace
arcpy.env.workspace = inWS
arcpy.env.overwriteOutput = 1
arcpy.env.extent = "-236 -1476 661 -806"

arcpy.env.cellSize = 1

ptFeatures = list()
ptFeatures = arcpy.ListFeatureClasses("","Point") #Only use points features

for fc in ptFeatures:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fName = arcpy.Describe(fc).basename 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.PointToRaster_conversion(fc,"Globvalue",outWS + "\\" + fName,"MAXIMUM","NONE",1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it works!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:50:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361101#M28469</guid>
      <dc:creator>BenjaminGale</dc:creator>
      <dc:date>2021-12-11T16:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop: Convert Point to Raster and Keep Base File Name In Output</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361102#M28470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Benjamin, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for providing this code.&amp;nbsp; I tried it, but Python still crashed. That you specified a separate out workspace in your code (before modified for me), made me think to try to store the grids in a separate folder than my workspace folder. This worked, but I'm not sure why. Apparently when you use the point to raster tool in Python, the output workspace where the grids get stored should be different than the input workspace where the point data are stored. It would be good if someone can confirm this is the case. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 13:47:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-convert-point-to-raster-and-keep-base/m-p/361102#M28470</guid>
      <dc:creator>MichaelBrady</dc:creator>
      <dc:date>2012-05-10T13:47:51Z</dc:date>
    </item>
  </channel>
</rss>

