Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No such file or directory @ rb_sysopen" using OpenURI

I've recently run into a problem using OpenURI. Every open method results in the following error:

"No such file or directory @ rb_sysopen".

My code looks simply like the following:

data = open("http://google.ca/")

I noticed the error shortly after adding gem 'nokogiri' to my Gemfile and running bundle install, though I have no indication of whether or not this caused the problem and have since removed the entry with no positive impact on the problem. Any help would be appreciated.

like image 349
Jamie Avatar asked Jun 18 '14 10:06

Jamie


2 Answers

Try to write require 'open-uri' before your code.

like image 56
jpalumickas Avatar answered Nov 12 '22 00:11

jpalumickas


I am using Ruby 3.0.1 and a part from the:

require "open-uri"

I have to explicitly call URI.open instead of just open:

data = URI.open("http://google.ca/")

Maybe it is something on new Ruby versions

like image 39
fguillen Avatar answered Nov 11 '22 22:11

fguillen