SciRuby / daru

Data Analysis in RUby
BSD 2-Clause "Simplified" License
1.03k stars 139 forks source link

packable error #500

Closed kojix2 closed 5 years ago

kojix2 commented 5 years ago

code

d1.rb

require 'daru'

df = Daru::DataFrame.new(a: [1,2,3], b:[4,5,6])
df.each(:row) { |i| puts i }

terminal

ruby d1.rb

error

/home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/packable-1.3.10/lib/packable/extensions/io.rb:86:in `pos': Illegal seek @ rb_io_tell - <STDOUT> (Errno::ESPIPE)
    from /home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/packable-1.3.10/lib/packable/extensions/io.rb:86:in `pack_and_write'
    from /home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/packable-1.3.10/lib/packable/extensions/io.rb:62:in `write_with_packing'
    from d1.rb:4:in `puts'
    from d1.rb:4:in `puts'
    from d1.rb:4:in `block in <main>'
    from /home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/daru-0.2.1/lib/daru/dataframe.rb:804:in `block in each_row'
    from /home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/daru-0.2.1/lib/daru/dataframe.rb:803:in `times'
    from /home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/daru-0.2.1/lib/daru/dataframe.rb:803:in `each_row'
    from /home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/daru-0.2.1/lib/daru/dataframe.rb:2489:in `dispatch_to_axis'
    from /home/kojix2/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/daru-0.2.1/lib/daru/dataframe.rb:834:in `each'
    from d1.rb:4:in `<main>'
Shekharrajak commented 5 years ago

@kojix2 , You were using Ruby < 2.5 ?

kojix2 commented 5 years ago

@Shekharrajak Ruby 2.6.1. This error does not always occur on any PC. I decided to close the issue because I thought it was not a problem with Ruby but an interference with the environment.

Shekharrajak commented 5 years ago

Yes! This problem will come when Ruby version > 2.4 .

Shekharrajak commented 5 years ago

Similar issue : https://github.com/SciRuby/daru/issues/503

Nakilon commented 2 years ago

Excuse me guys but I see three issues all linked to each other but I don't see the actual code patch. Am I blind? I get this exact exception in my not related gem and google doesn't say much about it, only leads here. I get it when I call .pos on stdout instance in some specific case within popen. I need it to count how much I've printed.

UPD:

$ ruby -e "p STDOUT.pos"
17800074
$ ruby -ropen3 -e "p Open3.capture2e 'ruby -e \"p STDOUT.pos\"'"
["-e:1:in `pos': Illegal seek @ rb_io_tell - <STDOUT> (Errno::ESPIPE)\n\tfrom -e:1:in `<main>'\n", #<Process::Status: pid 83602 exit 1>]

(the same on ruby 2.3.8 and 3.0.1)