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

Can't open Gzipped dataset #61

Closed
ohadle opened this issue Oct 1, 2018 · 2 comments
Closed

Can't open Gzipped dataset #61

ohadle opened this issue Oct 1, 2018 · 2 comments

Comments

@ohadle
Copy link

ohadle commented Oct 1, 2018

julia> dataset("MASS", "Boston")
ERROR: MethodError: no method matching position(::TranscodingStream{CodecZlib.GzipDecompressor,IOStream})
Closest candidates are:
  position(::IOStream) at iostream.jl:188
  position(::Base.Libc.FILE) at libc.jl:101
  position(::Base.Filesystem.File) at filesystem.jl:225
  ...
Stacktrace:
 [1] consumeBOM!(::TranscodingStream{CodecZlib.GzipDecompressor,IOStream}) at C:\Users\ohadl\.julia\packages\CSV\uLyo0\src\CSV.jl:209
 [2] #File#1(::Int64, ::Bool, ::Int64, ::Nothing, ::Int64, ::Nothing, ::Bool, ::Nothing, ::Bool, ::Array{String,1}, ::String, ::Char, ::Bool, ::Char, ::Nothing, ::Nothing, ::Char, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Dict{Type,Type}, ::Symbol, ::Bool, ::Bool, ::Bool, ::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:rows_for_type_detect,),Tuple{Int64}}}, ::Type, ::TranscodingStream{CodecZlib.GzipDecompressor,IOStream}) at C:\Users\ohadl\.julia\packages\CSV\uLyo0\src\CSV.jl:142
 [3] (::getfield(Core, Symbol("#kw#Type")))(::NamedTuple{(:delim, :quotechar, :missingstring, :rows_for_type_detect),Tuple{Char,Char,String,Int64}}, ::Type{CSV.File}, ::TranscodingStream{CodecZlib.GzipDecompressor,IOStream}) at .\none:0
 [4] #read#101(::Bool, ::Dict{Int64,Function}, ::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:delim, :quotechar, :missingstring, :rows_for_type_detect),Tuple{Char,Char,String,Int64}}}, ::Function, ::TranscodingStream{CodecZlib.GzipDecompressor,IOStream}, ::Type) at C:\Users\ohadl\.julia\packages\CSV\uLyo0\src\CSV.jl:304
 [5] (::getfield(CSV, Symbol("#kw##read")))(::NamedTuple{(:delim, :quotechar, :missingstring, :rows_for_type_detect),Tuple{Char,Char,String,Int64}}, ::typeof(CSV.read), ::TranscodingStream{CodecZlib.GzipDecompressor,IOStream}, ::Type) at .\none:0 (repeats 2 times)
 [6] (::getfield(RDatasets, Symbol("##1#2")){String,String})(::TranscodingStream{CodecZlib.GzipDecompressor,IOStream}) at C:\Users\ohadl\.julia\packages\RDatasets\mvYPU\src\dataset.jl:27
 [7] open(::getfield(RDatasets, Symbol("##1#2")){String,String}, ::Type{TranscodingStream{CodecZlib.GzipDecompressor,S} where S<:IO}, ::String, ::String) at C:\Users\ohadl\.julia\packages\TranscodingStreams\SaPZ8\src\stream.jl:157
 [8] dataset(::String, ::String) at C:\Users\ohadl\.julia\packages\RDatasets\mvYPU\src\dataset.jl:26
 [9] top-level scope at none:0

Adding various packages didn't help.
Maybe an API changed? This looks similar.

@laborg
Copy link
Contributor

laborg commented Oct 4, 2018

I've looked into the source code and the problem boils down to TranscodingStreams.jl not supporting position and seek (other methods are available though: seekstart, mark, reset).

So either position and seek get implemented there (corresponding issue: JuliaIO/TranscodingStreams.jl#62) or Parsers.jl and CSV.jl change their implementation to use only whats also available on all IO objects. I guess the former would be better.

@alejandromerchan
Copy link

I had a similar problem with some after the CSV update. My solution, which feels hacky but works, was to encansulate the io in CSV.read(IOBuffer(read(io))). Interestingly, after this, I don't seem to have "type-detect" issues, which were very common in my data. Don't know if that works here, because I was working with Zipped files, but if someone wants to try. I might do a test in a local branch later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants