<?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: I am learning python from a book, programming python with arcgis 10.1  I did everything from Chapter 7 but I have a mistake.  Here is the code  import arcpy, os try:   outputFC = arcpy.GetParameterAsText(0) fClassTemplate = arcpy.GetParameterAsText(1) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/i-am-learning-python-from-a-book-programming/m-p/210812#M16297</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First off, it is hard to tell if you are having issues due to indentation errors, or if it is just how it is showing here.&amp;nbsp; Look at &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;​&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;SPAN style="text-decoration: line-through;"&gt;3rd&lt;/SPAN&gt; 4th and &lt;SPAN style="text-decoration: line-through;"&gt;5th&lt;/SPAN&gt; 6th&amp;nbsp; line, as shown, need to be indented.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, it would also be helpful to see the actual error you are seeing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Apr 2016 09:32:46 GMT</pubDate>
    <dc:creator>RebeccaStrauch__GISP</dc:creator>
    <dc:date>2016-04-07T09:32:46Z</dc:date>
    <item>
      <title>I am learning python from a book, programming python with arcgis 10.1  I did everything from Chapter 7 but I have a mistake.  Here is the code  import arcpy, os try:   outputFC = arcpy.GetParameterAsText(0) fClassTemplate = arcpy.GetParameterAsText(1)   f</title>
      <link>https://community.esri.com/t5/python-questions/i-am-learning-python-from-a-book-programming/m-p/210811#M16296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 1em; color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt;I am learning&lt;/SPAN&gt; python from&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; a&lt;/SPAN&gt; book, programming python with arcgis 10.1&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;I&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; did everything&lt;/SPAN&gt; from Chapter 7 but&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; I&lt;/SPAN&gt; have&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; a&lt;/SPAN&gt; mistake.&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt;Here is the&lt;/SPAN&gt; code&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;import arcpy, os&lt;BR /&gt;try:&lt;BR /&gt;&amp;nbsp; outputFC = arcpy.GetParameterAsText(0)&lt;BR /&gt;fClassTemplate = arcpy.GetParameterAsText(1)&lt;BR /&gt;&amp;nbsp; f = open(arcpy.GetParameterAsText(2),'r')&lt;BR /&gt; arcpy.CreateFeatureclass_management(os.path.split(outputFC)&lt;BR /&gt;[0], os.path.split(outputFC[1]), "point", fClassTemplate)&lt;BR /&gt;&amp;nbsp; lstFires = f.readlines()&lt;BR /&gt;&amp;nbsp; cur = arcpy.InsertCursor(outputFC)&lt;BR /&gt;&amp;nbsp; cntr = 1&lt;BR /&gt;&amp;nbsp; for fire in lstFires:&lt;BR /&gt;&amp;nbsp; if 'Latitude' in fire:&lt;BR /&gt;&amp;nbsp; continue&lt;BR /&gt;&amp;nbsp; vals = fire.split(",")&lt;BR /&gt;&amp;nbsp; latitude = float(vals[0])&lt;BR /&gt;&amp;nbsp; longitude = float(vals[1])&lt;BR /&gt;&amp;nbsp; confid = int(vals[2])&lt;BR /&gt;&amp;nbsp; pnt = arcpy.Point(longitude, latitude)&lt;BR /&gt;&amp;nbsp; feat = cur.newRow()&lt;BR /&gt;&amp;nbsp; feat.shape = pnt&lt;BR /&gt;&amp;nbsp; feat.setValue("CONFIDENCEVALUE", confid)&lt;BR /&gt;&amp;nbsp; cur.insertRow(feat)&lt;BR /&gt;&amp;nbsp; arcpy.AddMessage("Record number: " + str(cntr) + " written to &lt;BR /&gt;feature class")&lt;BR /&gt;&amp;nbsp; cntr = cntr + 1&lt;BR /&gt;except:&lt;BR /&gt;&amp;nbsp; print arcpy.GetMessages()&lt;BR /&gt;finally:&lt;BR /&gt;&amp;nbsp; del cur&lt;BR /&gt;&amp;nbsp; f.close()&lt;/CODE&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;&lt;/CODE&gt;But when&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; I&lt;/SPAN&gt; run&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; the&lt;/SPAN&gt; Code&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; I&lt;/SPAN&gt; get mistake which connect del cur.&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;And&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; I&lt;/SPAN&gt; do not&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; understand&lt;/SPAN&gt; why&lt;SPAN class="diff-add" style="color: #405a04; background: #d1e1ad;"&gt; I&lt;/SPAN&gt; get this mistake.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 07:46:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-am-learning-python-from-a-book-programming/m-p/210811#M16296</guid>
      <dc:creator>AlesgerMammedov3</dc:creator>
      <dc:date>2016-04-07T07:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: I am learning python from a book, programming python with arcgis 10.1  I did everything from Chapter 7 but I have a mistake.  Here is the code  import arcpy, os try:   outputFC = arcpy.GetParameterAsText(0) fClassTemplate = arcpy.GetParameterAsText(1)</title>
      <link>https://community.esri.com/t5/python-questions/i-am-learning-python-from-a-book-programming/m-p/210812#M16297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First off, it is hard to tell if you are having issues due to indentation errors, or if it is just how it is showing here.&amp;nbsp; Look at &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;​&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;SPAN style="text-decoration: line-through;"&gt;3rd&lt;/SPAN&gt; 4th and &lt;SPAN style="text-decoration: line-through;"&gt;5th&lt;/SPAN&gt; 6th&amp;nbsp; line, as shown, need to be indented.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, it would also be helpful to see the actual error you are seeing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 09:32:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-am-learning-python-from-a-book-programming/m-p/210812#M16297</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-04-07T09:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: I am learning python from a book, programming python with arcgis 10.1  I did everything from Chapter 7 but I have a mistake.  Here is the code  import arcpy, os try:   outputFC = arcpy.GetParameterAsText(0) fClassTemplate = arcpy.GetParameterAsText(1)</title>
      <link>https://community.esri.com/t5/python-questions/i-am-learning-python-from-a-book-programming/m-p/210813#M16298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've briefly had a look at your code and have made a few changes. If you could attach a sample of your input data that you are reading from as well as the template Feature Class I'd be able to help you more. Also attach a print screen of the error message that you are receiving.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# import site-packages and modules
import arcpy
import os


# set arguments
outputFC = arcpy.GetParameterAsText(0)
fClassTemplate = arcpy.GetParameterAsText(1)
f = open(arcpy.GetParameterAsText(2),'r')


# set environment settings
arcpy.env.overwriteOutput = True


try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; output_path = os.path.split(outputFC)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; output_name = os.path.split(outputFC)[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(output_path, output_name, "point", fClassTemplate)
&amp;nbsp;&amp;nbsp;&amp;nbsp; lstFires = f.readlines()
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur = arcpy.InsertCursor(outputFC)
&amp;nbsp;&amp;nbsp;&amp;nbsp; cntr = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fire in lstFires:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if 'Latitude' in fire:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vals = fire.split(",")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; latitude = float(vals[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longitude = float(vals[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; confid = int(vals[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point(longitude, latitude)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = cur.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat.shape = pnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat.setValue("CONFIDENCEVALUE", confid)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.insertRow(feat)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Record number: " + str(cntr) + " written to feature class")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cntr = cntr + 1
except:
&amp;nbsp; print arcpy.GetMessages()
finally:
&amp;nbsp;&amp;nbsp;&amp;nbsp; del cur
&amp;nbsp;&amp;nbsp;&amp;nbsp; f.close()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:23:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-am-learning-python-from-a-book-programming/m-p/210813#M16298</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2021-12-11T10:23:01Z</dc:date>
    </item>
  </channel>
</rss>

