Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created January 29, 2012 23:40
Show Gist options
  • Save groovecoder/1701382 to your computer and use it in GitHub Desktop.
Save groovecoder/1701382 to your computer and use it in GitHub Desktop.
AttributeError: 'module' object has no attribute 'writer'
import csv
import os
STORING_TO_CSV = False
if 'STORE_TO_CSV' in os.environ:
facilities_csv = csv.writer(open('thd_facilities.csv', 'w'))
inspections_csv = csv.writer(open('thd_inspections.csv', 'w'))
STORING_TO_CSV = True
print "Storing to CSV"
def save_facility(facility):
if STORING_TO_CSV:
facilities_csv.writerow(**facility.values())
def save_inspection(inspection):
if STORING_TO_CSV:
inspections_csv.writerow(**inspection.values())
@ajithreddygeth
Copy link

Thanks.. csv.py is the culprit.. don't use the name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment