<?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: ListFields returning blanklist in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301074#M23345</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for checking.&amp;nbsp; The actual code has the full path name spelled out, just put that there for privacy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jul 2016 21:41:56 GMT</pubDate>
    <dc:creator>BlakeBarr</dc:creator>
    <dc:date>2016-07-26T21:41:56Z</dc:date>
    <item>
      <title>ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301070#M23341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone, I am trying to convert dbf to csv using the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
import csv


def DBFtoCSV(path):
&amp;nbsp;&amp;nbsp;&amp;nbsp; '''Convert every DBF table into CSV table.
&amp;nbsp;&amp;nbsp;&amp;nbsp; '''
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = path
&amp;nbsp;&amp;nbsp;&amp;nbsp; tablelist=arcpy.ListTables('*', 'dBASE')
&amp;nbsp;&amp;nbsp;&amp;nbsp; for table in tablelist:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputFile = '{}.csv'.format(table.split('.dbf')[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get the fields in the dbf to use for the cursor and csv header row.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for field in arcpy.ListFields(table):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.append(str(field.name))


# Make the csv.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with open((os.path.join(path,outputFile)),'wb') as output:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataWriter = csv.writer(output, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)


&amp;nbsp;&amp;nbsp;&amp;nbsp; # Write header row.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataWriter.writerow(fields)


&amp;nbsp;&amp;nbsp;&amp;nbsp; # Write each row of data to the csv.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(table, fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataWriter.writerow(row)


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('Finished creating {}'.format(outputFile))
&amp;nbsp;&amp;nbsp; 


if __name__ == '__main__': 
&amp;nbsp;&amp;nbsp;&amp;nbsp; path=r'F:\DataLocation'
&amp;nbsp;&amp;nbsp;&amp;nbsp; DBFtoCSV(path)&lt;/PRE&gt;&lt;P&gt;I am getting an error at the SearchCursor because it says field names must be string or non empty. I added the print statement and it turns out my list of fields is empty. Can anyone tell me why this is?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:26:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301070#M23341</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2021-12-11T14:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301071#M23342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listfields.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listfields.htm"&gt;ListFields—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Can you format your code to make it easier to read.&amp;nbsp; Also what is the table name when it prints?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/55181"&gt;Code Formatting... the basics++&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:34:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301071#M23342</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-26T21:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301072#M23343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you forget to include a real path?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14695692608636279 jive_macro_code jive_text_macro" data-renderedposition="60_8_1332_16" jivemacro_uid="_14695692608636279"&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;path=r'path'&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:40:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301072#M23343</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-07-26T21:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301073#M23344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have formatted the code.&amp;nbsp; When I print the table name it gives me "filename.dbf" The filename matches exactly with the name in the path directory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:40:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301073#M23344</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2016-07-26T21:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301074#M23345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for checking.&amp;nbsp; The actual code has the full path name spelled out, just put that there for privacy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:41:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301074#M23345</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2016-07-26T21:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301075#M23346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect it can't find a file, hence no fields, you will need a specific path&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301075#M23346</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-26T21:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301076#M23347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The path in the above code is just to protect the privacy of the directory and the data that I am working with. The actual path name leads to a folder with many files including dbf and non dbf.&amp;nbsp; The print table then lists the file inside that directory. Does this help? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:44:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301076#M23347</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2016-07-26T21:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301077#M23348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok... if the path is correct and the file is a dbase file, and its name prints out, you should be able to get a list of the fields using the syntax in the help... but you say it doesn't work (ps, the field.name, is a string already so no str is needed)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:46:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301077#M23348</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-26T21:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301078#M23349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you inspected the dBase files within ArcGIS? Possibly a problem in the files themselves?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 21:46:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301078#M23349</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-07-26T21:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301079#M23350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't yet. Will look into that now. If I cannot open them in ArcGIS, does that mean I cannot use arcpy tools to convert? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 22:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301079#M23350</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2016-07-26T22:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301080#M23351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dbase files can be added to arcmap no problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 22:21:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301080#M23351</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-26T22:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301081#M23352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct. Removed the string. It seems to be grabbing the file, but does not list the fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 22:26:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301081#M23352</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2016-07-26T22:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301082#M23353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, once I get into arcmap, I will get back to you on what it looks like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will there be any sign to look for which would tell me why the listfields is not working?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 22:39:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301082#M23353</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2016-07-26T22:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301083#M23354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just write a small script to read it directly from disk in a simple location using listtables, then list fields using the syntax in the link I sent.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy&amp;nbsp; &lt;SPAN class="comment token"&gt;# For each field in the Hospitals feature class, print # the field name, type, and length. &lt;/SPAN&gt;
fields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"c:/test/myfile.dbf"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&amp;nbsp; 
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{0} is a type of {1} with a length of {2}"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;type&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;length&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:26:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301083#M23354</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T14:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301084#M23355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's strange. Even when I feed in the direct location of the file, list fields is still returning an empty list?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made a separate script just to test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import dbf
import arcpy
import os
import csv

path=r'F:/Datalocation/'
arcpy.env.workspace = path


fields=arcpy.ListFields(r'F:Datalocation//dataset.dbf')
print fields&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Returns an empty list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the exact code you give me. Nothing prints. The listfields list continues to be empty so there is nothing to iterate over. I am not sure why.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301084#M23355</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2021-12-11T14:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301085#M23356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you are mixing filepath syntaxes&lt;/P&gt;&lt;P&gt;r'F:\Datalocation\dataset.dbf'&amp;nbsp; &lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;'F:/Datalocation/dataset.dbf'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:17:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301085#M23356</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-27T11:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301086#M23357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan.&amp;nbsp; Just Fixed that but still having same problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
import csv

path='F:/Datalocation/'
arcpy.env.workspace = path

fields=arcpy.ListFields('F:/datalocation/dataname.dbf')
for field in fields:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("{0} is a type of {1} with a length of {2}" .format(field.name, field.type, field.length)) 

#This doesn't print. Fields is empty




fieldlist1=[]
tablelist = arcpy.ListTables() # list tables in file
for table in tablelist:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldlist1.append(arcpy.ListFields(table))
print fieldlist1


#This part gives me an "ERROR 999999: ERROR EXECUTING FUNCTION"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:26:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301086#M23357</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2021-12-11T14:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301087#M23358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;attach the dbf... you may have to zip it to get past upload file types.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:28:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301087#M23358</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-27T11:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301088#M23359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan. Unfortunately, this is confidential data for a research project. I will look more into it but I can't share it. Is there a way to check if the file is corrupted which could be explaining the error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:35:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301088#M23359</guid>
      <dc:creator>BlakeBarr</dc:creator>
      <dc:date>2016-07-27T11:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: ListFields returning blanklist</title>
      <link>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301089#M23360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;open it up in a spreadsheet or some other program&lt;/P&gt;&lt;P&gt;export it out to a csv&lt;/P&gt;&lt;P&gt;if arcmap can load it and you can see the table in arcmap then it should be fine... if not, then it isn't&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listfields-returning-blanklist/m-p/301089#M23360</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-27T11:37:34Z</dc:date>
    </item>
  </channel>
</rss>

