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

Read StringIO with foreach #300

Open
MarcPer opened this issue May 3, 2024 · 2 comments · May be fixed by #302
Open

Read StringIO with foreach #300

MarcPer opened this issue May 3, 2024 · 2 comments · May be fixed by #302

Comments

@MarcPer
Copy link

MarcPer commented May 3, 2024

Proposal

I'd like to propose being able to open a StringIO s with CSV.foreach(s), just as it's possible to open a file with CSV.foreach(path).

I can investigate and open a PR if this behavior is desired.

Current behavior

The documentation already says it should be possible to pass an IO object to foreach, but if an instance of StringIO is passed, we get:

no implicit conversion of StringIO into String (TypeError)
@kou
Copy link
Member

kou commented May 3, 2024

If CSV.foeach(io) works, CSV.foreach(string_io) should work too.

@MarcPer
Copy link
Author

MarcPer commented May 3, 2024

Great, I'll open a PR with proposed changes in the next days.

@MarcPer MarcPer linked a pull request May 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants