Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gristle_freaker - problems with single-col file #34

Open
kenfar opened this issue Sep 3, 2013 · 0 comments
Open

gristle_freaker - problems with single-col file #34

kenfar opened this issue Sep 3, 2013 · 0 comments

Comments

@kenfar
Copy link
Owner

kenfar commented Sep 3, 2013

I've found that it fails a few different ways on files consisting of just a single field or column:

  • first the csv sniff module can't determine the delimiter. This can be bypassed by specifying one (even tho none exists in the data).

$ gristle_freaker col0.csv -c 0 -d','
Traceback (most recent call last):
File "/usr/local/bin/gristle_freaker", line 487, in
sys.exit(main())
File "/usr/local/bin/gristle_freaker", line 71, in main
dialect = get_dialect(opts, files)
File "/usr/local/bin/gristle_freaker", line 117, in get_dialect
my_file.analyze_file()
File "/usr/local/lib/python2.7/site-packages/gristle/file_type.py", line 98, in analyze_file
self.dialect.has_header = self._get_has_header(self._has_header)
File "/usr/local/lib/python2.7/site-packages/gristle/file_type.py", line 203, in _get_has_header
return csv.Sniffer().has_header(sample)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 392, in has_header
rdr = reader(StringIO(sample), self.sniff(sample))
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 184, in sniff
raise Error, "Could not determine delimiter"
_csv.Error: Could not determine delimiter

  • Secondly, the cvs sniff module fails on hasheader - this can be bypassed by specifying hasheader false in some other gristle utilities - but not this one.

$ gristle_freaker col0.csv -c 0 -d',' --hasheader false
Traceback (most recent call last):
File "/usr/local/bin/gristle_freaker", line 487, in
sys.exit(main())
File "/usr/local/bin/gristle_freaker", line 79, in main
opts.sampling_rate)
File "/usr/local/bin/gristle_freaker", line 187, in build_freq
for fields in csv.reader(fileinput.input(files), dialect):
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/fileinput.py", line 253, in next
line = self.readline()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/fileinput.py", line 351, in readline
return self.readline()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/fileinput.py", line 345, in readline
self._file = open(self._filename, self._mode)
IOError: [Errno 2] No such file or directory: 'false'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant