maxwell / screencap

A gem to screencap webpages in ruby. Uses Phantom.js under the hood.
MIT License
179 stars 63 forks source link

popen: no implicit conversion of nil into String (TypeError) #3

Closed kyledrake closed 10 years ago

kyledrake commented 10 years ago
require 'screencap'

f = Screencap::Fetcher.new('http://google.com')
screenshot = f.fetch
/Users/kyledrake/.rvm/gems/ruby-2.1.1/gems/phantomjs-1.9.7.0/lib/phantomjs.rb:50:in `popen': no implicit conversion of nil into String (TypeError)
    from /Users/kyledrake/.rvm/gems/ruby-2.1.1/gems/phantomjs-1.9.7.0/lib/phantomjs.rb:50:in `run'
    from /Users/kyledrake/.rvm/gems/ruby-2.1.1/gems/screencap-0.0.3/lib/screencap/phantom.rb:7:in `rasterize'
    from /Users/kyledrake/.rvm/gems/ruby-2.1.1/gems/screencap-0.0.3/lib/screencap/fetcher.rb:22:in `raster'
    from /Users/kyledrake/.rvm/gems/ruby-2.1.1/gems/screencap-0.0.3/lib/screencap/fetcher.rb:9:in `fetch'
    from screen.rb:4:in `<main>'
DEfusion commented 10 years ago

That just worked for me fine using latest version.

kyledrake commented 10 years ago
    # Run phantomjs with the given arguments, and either
    # return the stdout or yield each line to the passed block.
    def run(*args, &block)
      puts "PATH: #{path}"
      puts "ARGS: #{args.inspect}"
      IO.popen([path, *args]) do |io|
        block ? io.each(&block) : io.read
      end
    end
PATH: /Users/kyledrake/.phantomjs/1.9.7/darwin/bin/phantomjs
ARGS: ["/Users/kyledrake/.rvm/gems/ruby-2.1.1/gems/screencap-0.0.3/lib/screencap/raster.js", "http://google.com", "/Users/kyledrake/.rvm/gems/ruby-2.1.1/gems/screencap-0.0.3/tmp/httpgooglecom.png", nil]
kyledrake commented 10 years ago

Removing opts[:div] from Screencap::Fetcher#fetch's call to raster fixes it for me. It was fixed in master: https://github.com/maxwell/screencap/commit/cb5a0d1a871ea47db0a1e95a6cc49f53705a7c3d

@maxwell if you had a moment could you release a 0.0.4 gem? Thank you!

TheHodge commented 10 years ago

I've got the same issue, will pull the gem directly from github in the meantime.

DEfusion commented 10 years ago

Unfortunately I don't have permission to publish this gem, and have been using the gem via git directly myself for a while, so will have to wait for @maxwell to push the gem, which is now on version 0.1.1

maxwell commented 10 years ago

I'll add you as soon as I get back!

On Apr 5, 2014, at 11:32 AM, DEfusion notifications@github.com wrote:

Unfortunately I don't have permission to publish this gem, and have been using the gem via git directly myself for a while, so will have to wait for @maxwell to push the gem, which is now on version 0.1.1

— Reply to this email directly or view it on GitHub.

maxwell commented 10 years ago

What is your ruby gems email?

On Apr 5, 2014, at 11:32 AM, DEfusion notifications@github.com wrote:

Unfortunately I don't have permission to publish this gem, and have been using the gem via git directly myself for a while, so will have to wait for @maxwell to push the gem, which is now on version 0.1.1

— Reply to this email directly or view it on GitHub.

maxwell commented 10 years ago

added! Thank you all so much.

DEfusion commented 10 years ago

Ok pushed 0.1.1 gem