awesome-print / awesome_print

Pretty print your Ruby objects with style -- in full color and with proper indentation
http://github.com/michaeldv/awesome_print
MIT License
4.08k stars 454 forks source link

Awesome Print not working with MiniMagick output #95

Open designium opened 12 years ago

designium commented 12 years ago

When I'm using irb without awesome_print gem:

irb --simple-prompt   
require 'mini_magick'
File.exist? "qr_code.png"
trick = MiniMagick::Image.open('qr_code.png')

results:

<MiniMagick::Image:0x007f9693c2c550 @path="/tmp/mini_magick20120725-16052-1os0mk8.png", @tem

pfile=#<File:/tmp/mini_magick20120725-16052-1os0mk8.png (closed)>>

With awesome_print gem:

irb --simple-prompt   
require 'mini_magick'
File.exist? "qr_code.png"
trick = MiniMagick::Image.open('qr_code.png')

Resulting error from irb:

IOError: closed stream from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:181:in directory?' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:181:inawesome_file' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:26:in format' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/inspector.rb:104:inunnested' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/inspector.rb:71:in awesome' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:145:inblock (2 levels) in awesome_object' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:314:in indented' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:144:inblock in awesome_object' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:132:in map' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:132:inawesome_object' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:57:in awesome_self' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:28:informat' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/inspector.rb:104:in unnested' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/inspector.rb:71:inawesome' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:145:in block (2 levels) in awesome_object' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:314:inindented' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:144:in block in awesome_object' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:132:inmap' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:132:in awesome_object' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:57:inawesome_self' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/formatter.rb:28:in format' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/inspector.rb:104:inunnested' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/inspector.rb:71:in awesome' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/core_ext/kernel.rb:10:inai' from /Users/chimkan/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/awesome_print-1.0. 2/lib/awesome_print/core_ext/kernel.rb:15:in ap' from /Users/chimkan/.irbrc:11:inoutput_value' from /Users/chimkan/.rbenv/versions/1.9.3-p0/bin/irb:12:in `

'

Is there anything that can be done?

michaeldv commented 11 years ago

Are you getting the error with AP 1.1.0?

nateberkopec commented 8 years ago

I get this error with awesome-print 1.6.1. Here's a reproduction:

require 'objspace'
ObjectSpace.each_object.group_by(&:class)