August 31st, 2013, 01:00 AM
Join Date: Jul 2010
Time spent in forums: 1 Day 8 h 1 m 46 sec
Reputation Power: 4
Since it's critical to have proper whitespace to understand python code, please enclose your code in [ code ] tags so it looks like this:
from dbfpy import dbf
path = r"C:\Users\Stephen\Documents\House\Misc"
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
if filename.endswith( '.DBF'):
csv_fn = filename[:- 4]+ ".CSV"
with open(csv_fn, 'wb ') as csvfile:
in_db = dbf.Dbf(os.path.join(dirpath, filename), new= True)
out_csv = csv.writer(csvfile)
names = 
for field in in_db.header.fields:
for rec in in_db:
The way you've written this script, the .csv files should end up in the current working directory (the directory in which you're running the script). Is this the case?
If you want them to be in the same directory structure as your .dbf files, you'll need to prepend the path to csv_fn when you create it.