Repository navigation
fix: avoid blank rows in CSV exports on Windows - #88
Draft
rahul-mixpanel wants to merge 1 commit into
Draft
rahul-mixpanel wants to merge 1 commit into
rahul-mixpanel wants to merge 1 commit into
Conversation
csv.writer emits \r\n row terminators; opening the file in text mode without newline='' lets Windows translate the \n again, producing \r\r\n and a blank line after every row. Related to #49 (SDK-382) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Low impact] The PR appears safe to merge. Reviews (1) · Last reviewed commit: "fix: open CSV export file with newline='..." · Reviewed by Greptile |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_write_items_to_csvopened the output file in text mode withoutnewline="".csv.writeralready ends each row with\r\n, so on Windows the\nis translated again to\r\n. Each row then ends with\r\r\n, and spreadsheet tools show a blank row after every record. This is the case thecsvdocs warn about.The fix passes
newline=""toopen()atsrc/mixpanel_utils/__init__.py:1854.Customer impact: on macOS and Linux the bytes written are unchanged. On Windows, rows now end with a single
\r\ninstead of\r\r\n.Related to #49 (SDK-382)
Test plan
tests/test_write_items_to_csv.pysimulates Windows newline translation. It fails without the fix and passes with it.🤖 Generated with Claude Code