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

Fix when neither --delimiter nor --tab is provided. New default: ','. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
dist
*.pyc
*.egg-info
*~
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Patches and Suggestions
```````````````````````

- Christine Doig
- Yaiza Rubio
- Félix Brezo
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
History
-------

1.0.2 (2016-01-17)
++++++++++++++++++
- Fix when neither --delimiter nor --tab is provided. New default: ','.
- Added *~ to .gitignore

1.0.1 (2015-06-02)
++++++++++++++++++
- Add option to stream from stdin
Expand Down
10 changes: 6 additions & 4 deletions csv2es.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from retrying import retry


__version__ = '1.0.1'
__version__ = '1.0.2'
thread_local = local()


Expand Down Expand Up @@ -111,8 +111,9 @@ def sanitize_delimiter(delimiter, is_tab):
"""
Return a single character delimiter from the given (possibly unicode)
string. If is_tab is True, always return a single tab. If delimiter is None
then return None. Raise an Exception if the delimiter can't be converted to
a single character.
previously None was returned in previous versions, but a ',' is preferred
here to match the examples in the README. Raise an Exception if the
delimiter can't be converted to a single character.

Why is this so complicated with some kind of special artisan tab handling?
Well, passing in a tab character as a delimiter from the commandline as
Expand All @@ -130,7 +131,8 @@ def sanitize_delimiter(delimiter, is_tab):
return str('\t')

if delimiter is None:
return None
# Modified from None to ',' in 1.0.2
return str(',')
else:
d = str(delimiter)
if len(d) == 1:
Expand Down