-
Notifications
You must be signed in to change notification settings - Fork 130
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
IO doesn't work with CSV #65
Labels
Comments
Yup. I'll be doing the same workaround for the same issue. |
I ran into this issue as well. A workaround using streams is to provide a row separator to stream = sftp.file.open(filepath)
csv = CSV.new(stream, row_sep: "\n") |
Thanks for the report! PR-s are welcome! |
@mfazekas I'll give it a shot! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
io = sftp.file.open
claims to produce an IO-like object. Unfortunately, it doesn't seem to be quite io-like enough for ruby's built-in CSV library. If I doCSV.new(io)
, I get an error:Tracing this through, it looks like CSV is ultimately trying to call
io.get(separator, limit)
(which is supported in the full io spec, but sftp's io-like object only allows one argument.It's pretty simple to reproduce, but here's a test case anyway:
This isn't an urgent bug for me— I'll just ditch streams entirely and read the whole (small) file into memory before parsing it :). Just thought I'd log this in case someone else runs into the same issue (or in case I'm missing something and it's not a bug).
The text was updated successfully, but these errors were encountered: