<?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 to open dbf? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-to-open-dbf/m-p/140285#M10922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;dbf appears to be a function in the dbfpy module. To use your syntax you would have this in your imports.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;from dbfpy import dbf&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Or call it explicitly in your line&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;db = dbfpy.dbf.Dbf(complete_name)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I've never used the package dbfpy though, so I could be off.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Mar 2013 14:19:21 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2013-03-27T14:19:21Z</dc:date>
    <item>
      <title>python to open dbf?</title>
      <link>https://community.esri.com/t5/python-questions/python-to-open-dbf/m-p/140284#M10921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi guys, python novice here, thanks for any help....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;have this working so far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import re&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import dbfpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sqlite3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# create the geoprocessor object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create(9.3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.workspace = "I:\PDtest"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;layer1 = raw_input('what is layer1?')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer1 = layer1 + ".shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer2 = raw_input('what is layer2?')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer2 = layer2 + ".shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# process&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.PointDistance_analysis(layer1,layer2,"temp.dbf","#")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;layer1 = re.sub('.shp', '', layer1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer2 = re.sub('.shp', '', layer2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;final_layer = layer1+"_"+layer2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;complete_name = final_layer+".dbf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.Rename_management("temp.dbf", complete_name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...it runs a point distance analysis on two layers input by the user, and renames the resulting dbf to a combination of the two layer names.&amp;nbsp; this is pretty basic stuff but I'm new to this; now I want to open that resultant .dbf and use sqlite to interrogate it; I've imported dbfpy but can't seem to get past errors indicating that something is wrong with my dbf syntax....for example...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;db = dbf.Dbf(complete_name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for rec in db:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print rec&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;results in 'name dbf is not defined', and several edits to this result in similar problems; what am I doing wrong when trying to open this .dbf?&amp;nbsp; I seem to have dbfpy in the proper place so that shouldn't be an issue...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks very much,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cj&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 13:22:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-to-open-dbf/m-p/140284#M10921</guid>
      <dc:creator>ChrisJ</dc:creator>
      <dc:date>2013-03-27T13:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: python to open dbf?</title>
      <link>https://community.esri.com/t5/python-questions/python-to-open-dbf/m-p/140285#M10922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;dbf appears to be a function in the dbfpy module. To use your syntax you would have this in your imports.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;from dbfpy import dbf&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Or call it explicitly in your line&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;db = dbfpy.dbf.Dbf(complete_name)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I've never used the package dbfpy though, so I could be off.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 14:19:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-to-open-dbf/m-p/140285#M10922</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-03-27T14:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: python to open dbf?</title>
      <link>https://community.esri.com/t5/python-questions/python-to-open-dbf/m-p/140286#M10923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks for replying mc; I've just tried your suggestion and while it hasn't worked yet, I see what you mean; will keep trying and come back if it works, thanks again...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: haven't gotten this going yet after many combinations of suspect syntax....what I'm trying to do is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) make a dbf (DONE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) open the dbf, so that I can:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) use sqlite to interrogate the dbf (I need to use more powerful sql than the feeble sql box in arcmap's select by attribute box - why IS it so poor just out of curiosity?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks very much all...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cj&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 14:29:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-to-open-dbf/m-p/140286#M10923</guid>
      <dc:creator>ChrisJ</dc:creator>
      <dc:date>2013-03-27T14:29:22Z</dc:date>
    </item>
  </channel>
</rss>

