How to use the unicodecsv.csv function in unicodecsv

To help you get started, we’ve selected a few unicodecsv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github radremedy / radremedy / remedy / data_importer / data_importer.py View on Github external
csvfile = open(file_path, 'rb')

        # Determine the encoding
        encoding = chardet.detect(csvfile.read())

        if encoding['encoding'] is not None:
            encoding = encoding['encoding'].lower()
        else:
            encoding = 'utf-8'

        # Go back to the beginning
        csvfile.seek(0)

        # Get the equivalent reader using the determined encoding
        return unicodecsv.DictReader(csvfile, encoding=encoding)
    except unicodecsv.csv.Error:
        # In the event of a CSV error, close the file handle
        if csvfile is not None:
            csvfile.close()

        # Re-throw the exception
        raise
github timClicks / prequel / prequel.py View on Github external
import datetime
import json
import os
import sqlite3
import string
import tempfile
import textwrap
import time
import warnings


import requests
from propeller import propeller #https://github.com/mbarkhau/python-propeller
try:
  import unicodecsv
  csv = unicodecsv.csv
except ImportError:
  import sys
  if sys.version_info[0] == 2:
    warnings.warn("In Python 2, CSV lacks good support for Unicode.")
  import csv

from foreign import memorize, pluralize

SAFE_CHARS = frozenset(string.ascii_letters + "_")

TYPE_MAP = {
      "blob"    : "BLOB",
      "category": "INTEGER",
      "id"      : "INTEGER",
      "integer" : "INTEGER",
      "float"   : "REAL",