Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 6 commits
  • 6 files changed
  • 0 commit comments
  • 3 contributors
Commits on May 12, 2012
@msabramo msabramo Fix for the fact that some versions of the csv module (apparently
including some bundled with pypy) misspell the word "larger" as
"larget". This fixes one pypy test failure mentioned in GH-165.
Commits on May 15, 2012
@onyxfish onyxfish Merge pull request #170 from msabramo/fix-pypy-larget-test-failure
Fix for the fact that some versions of the csv module (apparently
@onyxfish onyxfish Add Marc Abramowitz to AUTHORS. ad4cd7a
Commits on May 16, 2012
@onyxfish onyxfish Add DBF support to docs. Closes #167. b79e007
Commits on Jun 02, 2012
@JoeGermuska Merge branch 'master' of 1e71768
@JoeGermuska make 'encoding' a kwarg for FixedWidthReader, so that python code can…
… handle non-default encodings, not just in2csv
1  AUTHORS
@@ -17,3 +17,4 @@ The following individuals have contributed code to csvkit:
* Anton Ian Sipos
* Gregory Temchenko
* Kevin Schaul
+* Marc Abramowitz
14 csvkit/convert/
@@ -21,12 +21,14 @@ def fixed2csv(f, schema, output=None, **kwargs):
if not streaming:
output = StringIO()
- if 'encoding' in kwargs and kwargs['encoding']:
- f = iterdecode(f, kwargs['encoding'])
+ try:
+ encoding = kwargs['encoding']
+ except KeyError:
+ encoding = None
writer = CSVKitWriter(output)
- reader = FixedWidthReader(f, schema)
+ reader = FixedWidthReader(f, schema, encoding=encoding)
if not streaming:
@@ -43,7 +45,9 @@ class FixedWidthReader(object):
The schema_file should be in CSV format with a header row which has columns 'column', 'start', and 'length'. (Other columns will be ignored.) Values in the 'start' column are assumed to be "zero-based" unless the first value is "1" in which case all values are assumed to be "one-based."
- def __init__(self, f, schema):
+ def __init__(self, f, schema, encoding=None):
+ if encoding is not None:
+ f = iterdecode(f, encoding)
self.file = f
self.parser = FixedWidthRowParser(schema)
self.header = True
3  csvkit/
@@ -6,6 +6,7 @@
import codecs
import csv
+import fnmatch
from cStringIO import StringIO
from csvkit.exceptions import FieldSizeLimitError
@@ -40,7 +41,7 @@ def next(self):
row =
except csv.Error, e:
# Terrible way to test for this exception, but there is no subclass
- if 'field larger than field limit' in str(e):
+ if fnmatch.fnmatch(str(e), 'field large[rt] than field limit *'):
raise FieldSizeLimitError(csv.field_size_limit())
raise e
6 docs/scripts/in2csv.rst
@@ -31,7 +31,7 @@ The header line is required though the columns may be in any order::
-f FORMAT, --format FORMAT
The format of the input file. If not specified will be
inferred from the filename. Supported formats: csv,
- fixed, json, xls, xlsx.
+ dbf, fixed, json, xls, xlsx.
-s SCHEMA, --schema SCHEMA
Specifies a CSV-formatted schema file for converting
fixed-width files. See documentation for details.
@@ -68,3 +68,7 @@ Fetch csvkit's open issues from the Github API, convert the JSON response into a
$ curl | in2csv -v -k issues > issues.csv
+Convert a DBase DBF file to an equivalent CSV::
+ $ in2csv examples/testdbf.dbf > testdbf_converted.csv
4 requirements.txt
@@ -1,5 +1,5 @@
@@ -7,4 +7,4 @@ sphinx==1.0.7
2 
@@ -50,5 +50,5 @@
- 'dbf==0.90.004']
+ 'dbf==0.93.000']

No commit comments for this range

Something went wrong with that request. Please try again.