screencap icon indicating copy to clipboard operation
screencap copied to clipboard

uninitialized constant Screencap::Phantom::CGI

Open galetahub opened this issue 10 years ago • 3 comments

screencap-0.1.1.gem phantomjs-1.9.7.1.gem

require 'screencap'
f = Screencap::Fetcher.new('http://google.com')
screenshot = f.fetch
NameError: uninitialized constant Screencap::Phantom::CGI
    from /Volumes/Data/mario/.rvm/gems/ruby-2.0.0-p451/gems/screencap-0.1.1/lib/screencap/phantom.rb:7:in `rasterize'
    from /Volumes/Data/mario/.rvm/gems/ruby-2.0.0-p451/gems/screencap-0.1.1/lib/screencap/fetcher.rb:24:in `raster'
    from /Volumes/Data/mario/.rvm/gems/ruby-2.0.0-p451/gems/screencap-0.1.1/lib/screencap/fetcher.rb:9:in `fetch'
    from (irb):3
    from /Volumes/Data/mario/.rvm/rubies/ruby-2.0.0-p451/bin/irb:12:in `<main>'

galetahub avatar Nov 03 '14 08:11 galetahub

Huh, I thought I'd patched this a few months ago. Maybe not in the latest published gem?

jamiew avatar Nov 04 '14 14:11 jamiew

Hi, i'm getting a similar error with the same gem versions & code and also using the master branch of this repo as the gem source.

phantomjs 1.9.7.1
screencap 0.1.1
/usr/local/var/rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/screencap-0.1.1/lib/screencap/phantom.rb:7:in
`rasterize': uninitialized constant Screencap::Phantom::CGI (NameError)

chrism avatar Nov 05 '14 15:11 chrism

same environment, and same issue on here.

irb(main):001:0> require 'screencap'
=> true
irb(main):002:0> f = Screencap::Fetcher.new('https://ubit.info/ssut')
=> #<Screencap::Fetcher:0x007fa4518d8c70 @url="https://ubit.info/ssut">
irb(main):003:0> f.fetch(output: 'ssut.png', div: '#music_list')
NameError: uninitialized constant Screencap::Phantom::CGI
    from /Library/Ruby/Gems/2.0.0/gems/screencap-0.1.1/lib/screencap/phantom.rb:7:in `rasterize'
    from /Library/Ruby/Gems/2.0.0/gems/screencap-0.1.1/lib/screencap/fetcher.rb:24:in `raster'
    from /Library/Ruby/Gems/2.0.0/gems/screencap-0.1.1/lib/screencap/fetcher.rb:9:in `fetch'
    from (irb):3
    from /usr/bin/irb:12:in `<main>'

i have checked the issue #8 and now it works properly when i execute require 'cgi' before fetching.

ssut avatar Nov 11 '14 03:11 ssut