ericraio
ericraio

Reputation: 1469

No such file or directory

This is the error.

Atrosity [ Eric-Raios-MacBook ][ ~/dev/rubyscripts ]$ ruby script.rb 
script.rb:7:in `read': No such file or directory - sent (Errno::ENOENT)
from script.rb:7:in `lSent'
from script.rb:16:in `<main>'

My Method that is causing the error is:

def lSent
  $sent = Set.new(File.read("sent").split(";"))
end

lSent

If I delete this, my script runs but does not output what I want to do.

Upvotes: 0

Views: 941

Answers (2)

Felipe Sabino
Felipe Sabino

Reputation: 18215

sent should be a path to a file in your server, such as

$sent = Set.new(File.read("/root/path/file.txt").split(";"))

Upvotes: 4

Christopher Armstrong
Christopher Armstrong

Reputation: 7953

You're attempting to read a file called "sent", but it doesn't exist in the application's path. Try including the full path to the file.

Upvotes: 3

Related Questions