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 newline windows issue in generate_csv #675

Closed
wants to merge 1 commit into from
Closed

Conversation

dbish
Copy link
Contributor

@dbish dbish commented Jul 23, 2022

Fixes #674

Changes

updated tutorial in documentation to specify the newline explitly
writer = csv.DictWriter(open(f"sample_data{file_label}.csv", "w", newline=''), fieldnames=fieldnames)

instead of:
writer = csv.DictWriter(open(f"sample_data{file_label}.csv", "w"), fieldnames=fieldnames)

Testing

  • tested by running the generate_csv function before and after on a windows machine, before was creating newlines between lines and throwing errors, after the created files don't have newlines and full tutorial works

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 23, 2022
@dbish
Copy link
Contributor Author

dbish commented Jul 23, 2022

@facebook-github-bot
Copy link
Contributor

@NivekT has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

ejguan pushed a commit to ejguan/data that referenced this pull request Aug 5, 2022
Summary:
Fixes pytorch#674

### Changes

updated tutorial in documentation to specify the newline explitly
`writer = csv.DictWriter(open(f"sample_data{file_label}.csv", "w", newline=''), fieldnames=fieldnames)`

instead of:
`writer = csv.DictWriter(open(f"sample_data{file_label}.csv", "w"), fieldnames=fieldnames)`

## Testing
- tested by running the generate_csv function before and after on a windows machine, before was creating newlines between lines and throwing errors, after the created files don't have newlines and full tutorial works

Pull Request resolved: pytorch#675

Reviewed By: ejguan

Differential Revision: D38116301

Pulled By: NivekT

fbshipit-source-id: 1885c40cdc739ca70c5236e983389d88f662b2d4
ejguan pushed a commit that referenced this pull request Aug 5, 2022
Summary:
Fixes #674

### Changes

updated tutorial in documentation to specify the newline explitly
`writer = csv.DictWriter(open(f"sample_data{file_label}.csv", "w", newline=''), fieldnames=fieldnames)`

instead of:
`writer = csv.DictWriter(open(f"sample_data{file_label}.csv", "w"), fieldnames=fieldnames)`

## Testing
- tested by running the generate_csv function before and after on a windows machine, before was creating newlines between lines and throwing errors, after the created files don't have newlines and full tutorial works

Pull Request resolved: #675

Reviewed By: ejguan

Differential Revision: D38116301

Pulled By: NivekT

fbshipit-source-id: 1885c40cdc739ca70c5236e983389d88f662b2d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generate_csv in tutorial won't work correctly on windows
3 participants