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 writing compressed CSVs in python3 #188

Merged
merged 1 commit into from Apr 30, 2015
Merged

Fix writing compressed CSVs in python3 #188

merged 1 commit into from Apr 30, 2015

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Apr 30, 2015

closes #187

@cpcloud cpcloud self-assigned this Apr 30, 2015
@cpcloud cpcloud added this to the 0.3.3 milestone Apr 30, 2015
@cpcloud cpcloud added the bug label Apr 30, 2015
@cpcloud
Copy link
Member Author

cpcloud commented Apr 30, 2015

@TomAugspurger look ok to you?

@@ -91,7 +92,10 @@ def append_dataframe_to_csv(c, df, dshape=None, **kwargs):
encoding=kwargs.get('encoding', c.encoding)

if ext(c.path) in compressed_open:
f = compressed_open[ext(c.path)](c.path, mode='a')
kwargs = dict(mode='at')
if sys.version_info[0] >= 3:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.version_info is a named tuple so you can do sys.version_info.major if you think thats cleaner

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alas, we have to support python 2.6, which doesn't implement sys.version_info as a namedtuple:

Python 2.6.9 |Continuum Analytics, Inc.| (unknown, Jan 10 2014, 13:33:57)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
(2, 6, 9, 'final', 0)

@cpcloud
Copy link
Member Author

cpcloud commented Apr 30, 2015

cool, going to give a go on windows and will merge if that's successful

@cpcloud
Copy link
Member Author

cpcloud commented Apr 30, 2015

looks good on windows, merging

cpcloud added a commit that referenced this pull request Apr 30, 2015
Fix writing compressed CSVs in python3
@cpcloud cpcloud merged commit 00cdf74 into blaze:master Apr 30, 2015
@cpcloud cpcloud deleted the compression-encoding branch April 30, 2015 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Py3: Encode strings when compressing
2 participants